Skip to content

Commit 941af21

Browse files
PerMacnashif
authored andcommitted
twister: Use alternative test sorting when --device-testing
Change the sorting of test instances if --device-testing is used within subsets. Test instances are sored depending on the context. For CI runs the execution order is: "platform1-testA, platform1-testB, ..., platform1-testZ, platform2-testA, ...". For hardware tests, were multiple platforms can run the tests in parallel, it is more efficient to run in the order: "platform1-testA, platform2-testA, ..., platform1-testB, platform2-testB, ..." This can significantly reduce the tests execution time for setups with multiple different platforms connected. Signed-off-by: Maciej Perkowski <[email protected]>
1 parent 3740f60 commit 941af21

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/twister

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,17 @@ def main():
11141114
return
11151115

11161116
if options.subset:
1117-
suite.instances = OrderedDict(sorted(suite.instances.items()))
1117+
# Test instances are sorted depending on the context. For CI runs
1118+
# the execution order is: "plat1-testA, plat1-testB, ...,
1119+
# plat1-testZ, plat2-testA, ...". For hardware tests
1120+
# (device_testing), were multiple physical platforms can run the tests
1121+
# in parallel, it is more efficient to run in the order:
1122+
# "plat1-testA, plat2-testA, ..., plat1-testB, plat2-testB, ..."
1123+
if options.device_testing:
1124+
suite.instances = OrderedDict(sorted(suite.instances.items(),
1125+
key=lambda x: x[0][x[0].find("/") + 1:]))
1126+
else:
1127+
suite.instances = OrderedDict(sorted(suite.instances.items()))
11181128

11191129
subset, sets = options.subset.split("/")
11201130
subset = int(subset)

0 commit comments

Comments
 (0)