twister: platform filtering when test-only

Add the functionality to use -p and -P to filter out platforms
when using test-only

Signed-off-by: Pavlo Havrylyuk <pavlo.havrylyuk@infineon.com>
This commit is contained in:
Pavlo Havrylyuk 2023-09-15 07:52:50 -07:00 committed by Anas Nashif
commit 8f37003401

View file

@ -216,11 +216,16 @@ class TestPlan:
# in cases where no platform was specified when running the tests. # in cases where no platform was specified when running the tests.
# If the platform does not exist in the hardware map, just skip it. # If the platform does not exist in the hardware map, just skip it.
connected_list = [] connected_list = []
if not self.options.platform: if self.options.platform:
connected_list = self.options.platform
else:
for connected in self.hwm.duts: for connected in self.hwm.duts:
if connected['connected']: if connected['connected']:
connected_list.append(connected['platform']) connected_list.append(connected['platform'])
if self.options.exclude_platform:
for excluded in self.options.exclude_platform:
if excluded in connected_list:
connected_list.remove(excluded)
self.load_from_file(last_run, filter_platform=connected_list) self.load_from_file(last_run, filter_platform=connected_list)
self.selected_platforms = set(p.platform.name for p in self.instances.values()) self.selected_platforms = set(p.platform.name for p in self.instances.values())
else: else: