From dee8bb5ed0b7db7009c6cace616b2bb3cb1e8e93 Mon Sep 17 00:00:00 2001 From: Manoel Brunnen Date: Mon, 18 Sep 2023 11:00:48 +0200 Subject: [PATCH] twister: fix test plan to skip unconnected platforms Remove dead and erroneous (DUT is not a dict) if branch. Simply use the self.options.platform list. Which is filled by either the hardware map or the '--platform' option. This change addresses issue #62723 and #62560. Signed-off-by: Manoel Brunnen --- scripts/pylib/twister/twisterlib/testplan.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index f7242943df6..2e0eb9880f7 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -215,16 +215,10 @@ class TestPlan: self.load_from_file(self.options.load_tests) self.selected_platforms = set(p.platform.name for p in self.instances.values()) elif self.options.test_only: - # Get list of connected hardware and filter tests to only be run on connected hardware - # in cases where no platform was specified when running the tests. - # If the platform does not exist in the hardware map, just skip it. - connected_list = [] - if self.options.platform: - connected_list = self.options.platform - else: - for connected in self.hwm.duts: - if connected['connected']: - connected_list.append(connected['platform']) + # Get list of connected hardware and filter tests to only be run on connected hardware. + # If the platform does not exist in the hardware map or was not specified by --platform, + # just skip it. + connected_list = self.options.platform if self.options.exclude_platform: for excluded in self.options.exclude_platform: if excluded in connected_list: