Skip to content

Commit d590e0d

Browse files
galaknashif
authored andcommitted
twister: Adjust platform selection logic for platform_allow
In CI we typically build for "default" platforms. However some testcases that set "platform_allow" may have no overlap with the default platforms and thus thoses testcases will not get built. Change the platform selection logic in these cases to set the platforms to the list of allowed platforms ("platform_allow") in the testcase. Signed-off-by: Kumar Gala <[email protected]>
1 parent 5a51fe5 commit d590e0d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,6 +3055,18 @@ def apply_filters(self, **kwargs):
30553055
else:
30563056
platform_scope = platforms
30573057

3058+
integration = self.integration and tc.integration_platforms
3059+
3060+
# If there isn't any overlap between the platform_allow list and the platform_scope
3061+
# we set the scope to the platform_allow list
3062+
if tc.platform_allow and not platform_filter and not integration:
3063+
a = set(platform_scope)
3064+
b = set(filter(lambda item: item.name in tc.platform_allow, self.platforms))
3065+
c = a.intersection(b)
3066+
if not c:
3067+
platform_scope = list(filter(lambda item: item.name in tc.platform_allow, \
3068+
self.platforms))
3069+
30583070
# list of instances per testcase, aka configurations.
30593071
instance_list = []
30603072
for plat in platform_scope:
@@ -3163,7 +3175,6 @@ def apply_filters(self, **kwargs):
31633175
if not instance_list:
31643176
continue
31653177

3166-
integration = self.integration and tc.integration_platforms
31673178
# if twister was launched with no platform options at all, we
31683179
# take all default platforms
31693180
if default_platforms and not tc.build_on_all and not integration:
@@ -3175,7 +3186,7 @@ def apply_filters(self, **kwargs):
31753186
aa = list(filter(lambda tc: tc.platform.name in c, instance_list))
31763187
self.add_instances(aa)
31773188
else:
3178-
self.add_instances(instance_list[:1])
3189+
self.add_instances(instance_list)
31793190
else:
31803191
instances = list(filter(lambda tc: tc.platform.default, instance_list))
31813192
self.add_instances(instances)

0 commit comments

Comments
 (0)