Skip to content

Commit a708865

Browse files
authored
Run test scripts in predefined order (#1210)
instead of some nondeterministic order Signed-off-by: Matthias Büchse <matthias.buechse@alasca.cloud>
1 parent 888073b commit a708865

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

Tests/scs-compliance-check.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def main(argv):
334334
# collect scripts to be run
335335
testcase_lookup = spec['testcases']
336336
tc_script_lookup = spec['tc_scripts']
337-
script_info = {}
337+
script_tc_ids = [[] for _ in spec['scripts']]
338338
for tc_id in all_testcase_ids:
339339
script = tc_script_lookup[tc_id]
340340
if 'executable' not in script:
@@ -343,16 +343,13 @@ def main(argv):
343343
continue
344344
if config.tests and not config.tests.match(tc_id):
345345
continue
346-
item = script_info.get(id(script))
347-
if item is None:
348-
_, testcase_ids = script_info[id(script)] = (script, [])
349-
else:
350-
_, testcase_ids = item
351-
testcase_ids.append(tc_id)
346+
idx = script['_idx']
347+
script_tc_ids[idx].append(tc_id)
352348
# run scripts
353349
invocations = [
354-
runner.run(script, testcases=sorted(testcases))
355-
for script, testcases in script_info.values()
350+
runner.run(script, testcases=sorted(tc_ids))
351+
for script, tc_ids in zip(spec['scripts'], script_tc_ids)
352+
if tc_ids
356353
]
357354
results = {}
358355
for invocation in invocations:

Tests/scs_cert_lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def _resolve_spec(spec: dict):
5959
# step 1. build lookups
6060
testcase_lookup = {}
6161
tc_script_lookup = {}
62-
for script in spec.get('scripts', ()):
62+
for idx, script in enumerate(spec.get('scripts', ())):
63+
script['_idx'] = idx
6364
for testcase in script.get('testcases', ()):
6465
id_ = testcase['id']
6566
if id_ in testcase_lookup:

0 commit comments

Comments
 (0)