Skip to content

Commit e90559f

Browse files
nashifhenrikbrixandersen
authored andcommitted
twister: fix platform filter when loading plan from file
if alias or shorthand name is provided on the command line, we need convert this to complete target name for the filters to work. Fixes #80332 Signed-off-by: Anas Nashif <[email protected]>
1 parent 625246f commit e90559f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

scripts/pylib/twister/twisterlib/testplan.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,21 @@ def load(self):
230230
# Get list of connected hardware and filter tests to only be run on connected hardware.
231231
# If the platform does not exist in the hardware map or was not specified by --platform,
232232
# just skip it.
233-
connected_list = self.options.platform
233+
234+
connected_list = []
235+
excluded_list = []
236+
for _cp in self.options.platform:
237+
if _cp in self.platform_names:
238+
connected_list.append(self.get_platform(_cp).name)
239+
234240
if self.options.exclude_platform:
235-
for excluded in self.options.exclude_platform:
241+
for _p in self.options.exclude_platform:
242+
if _p in self.platform_names:
243+
excluded_list.append(self.get_platform(_p).name)
244+
for excluded in excluded_list:
236245
if excluded in connected_list:
237246
connected_list.remove(excluded)
247+
238248
self.load_from_file(last_run, filter_platform=connected_list)
239249
self.selected_platforms = set(p.platform.name for p in self.instances.values())
240250
else:

scripts/tests/twister/test_testplan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def test_testplan_discover(
594594
(None, None, 'load_tests.json', None, '0/4',
595595
TwisterRuntimeError, set(['lt-p1', 'lt-p3', 'lt-p4', 'lt-p2']), []),
596596
('suffix', None, None, True, '2/4',
597-
None, set(['ts-p4', 'ts-p2', 'ts-p3']), [2, 4]),
597+
None, set(['ts-p4', 'ts-p2', 'ts-p1', 'ts-p3']), [2, 4]),
598598
]
599599

600600
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)