Skip to content

Commit 173468c

Browse files
committed
twister: filters: fix processing of platform scope
Optimize code and fix process being killed when llaunched with --all. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent 5bbc6ee commit 173468c

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

scripts/pylib/twister/twisterlib/testplan.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ def apply_filters(self, **kwargs):
733733
logger.info("Selecting default platforms per testsuite scenario")
734734
default_platforms = True
735735
elif emu_filter:
736-
logger.info("Selecting emulation platforms per testsuite scenraio")
736+
logger.info("Selecting emulation platforms per testsuite scenario")
737737
emulation_platforms = True
738738
elif vendor_filter:
739739
vendor_platforms = True
@@ -767,32 +767,35 @@ def apply_filters(self, **kwargs):
767767
platforms = self.platforms
768768

769769
platform_config = self.test_config.get('platforms', {})
770+
# test configuration options
771+
test_config_options = self.test_config.get('options', {})
772+
integration_mode_list = test_config_options.get('integration_mode', [])
773+
770774
logger.info("Building initial testsuite list...")
771775

772776
keyed_tests = {}
773-
774777
for _, ts in self.testsuites.items():
775-
if (
776-
ts.build_on_all
777-
and not platform_filter
778-
and platform_config.get('increased_platform_scope', True)
779-
):
780-
platform_scope = self.platforms
781-
elif ts.integration_platforms:
782-
integration_platforms = list(
778+
if ts.integration_platforms:
779+
_integration_platforms = list(
783780
filter(lambda item: item.name in ts.integration_platforms, self.platforms)
784781
)
785-
if self.options.integration:
786-
platform_scope = integration_platforms
782+
else:
783+
_integration_platforms = []
784+
785+
if (ts.build_on_all and not platform_filter and
786+
platform_config.get('increased_platform_scope', True)):
787+
# if build_on_all is set, we build on all platforms
788+
platform_scope = self.platforms
789+
elif ts.integration_platforms and self.options.integration:
790+
# if integration is set, we build on integration platforms
791+
platform_scope = _integration_platforms
792+
elif ts.integration_platforms and not platform_filter:
793+
# if integration platforms are set, we build on those and integration mode is set
794+
# for this test suite, we build on integration platforms
795+
if any(ts.id.startswith(i) for i in integration_mode_list):
796+
platform_scope = _integration_platforms
787797
else:
788-
platform_scope = platforms
789-
if not platform_filter:
790-
tco = self.test_config.get('options', {})
791-
im = tco.get('integration_mode', [])
792-
if any(ts.id.startswith(i) for i in im):
793-
platform_scope = integration_platforms
794-
else:
795-
platform_scope += integration_platforms
798+
platform_scope = platforms + _integration_platforms
796799
else:
797800
platform_scope = platforms
798801

0 commit comments

Comments
 (0)