Skip to content

Commit

Permalink
Use a list for tests in src/tests/run.py (#78463)
Browse files Browse the repository at this point in the history
Otherwise we may problems due to multiple test assemblies having tests
of the same name (e.g. due to _r, _ro versions of the same tests).

Fix #78462
  • Loading branch information
jakobbotsch committed Nov 19, 2022
1 parent 6b170de commit 0f3a88b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ def parse_test_results_xml_file(args, item, item_name, tests, assemblies):
Args:
xml_result_file : results xml file to parse
args : arguments
tests : dictionary of individual test results
tests : list of individual test results
assemblies : dictionary of per-assembly aggregations
"""

Expand Down Expand Up @@ -1252,14 +1252,13 @@ def parse_test_results_xml_file(args, item, item_name, tests, assemblies):
if test_location_on_filesystem is None or not os.path.isfile(test_location_on_filesystem):
test_location_on_filesystem = None
test_output = test.findtext("output")
assert tests[test_name] == None
tests[test_name] = defaultdict(lambda: None, {
tests.append(defaultdict(lambda: None, {
"name": test_name,
"test_path": test_location_on_filesystem,
"result" : result,
"time": time,
"test_output": test_output
})
}))
if result == "Pass":
assembly_info["passed"] += 1
elif result == "Fail":
Expand All @@ -1283,7 +1282,6 @@ def print_summary(tests, assemblies):
failed_tests = []

for test in tests:
test = tests[test]
if test["result"] == "Fail":
print("Failed test: %s" % test["name"])

Expand Down Expand Up @@ -1350,7 +1348,7 @@ def create_repro(args, env, tests):
"""
assert tests is not None

failed_tests = [tests[item] for item in tests if tests[item]["result"] == "Fail" and tests[item]["test_path"] is not None]
failed_tests = [test for test in tests if test["result"] == "Fail" and test["test_path"] is not None]
if len(failed_tests) == 0:
return

Expand Down Expand Up @@ -1395,7 +1393,7 @@ def main(args):

if not args.skip_test_run:
assemblies = defaultdict(lambda: None)
tests = defaultdict(lambda: None)
tests = []
parse_test_results(args, tests, assemblies)
print_summary(tests, assemblies)
create_repro(args, env, tests)
Expand Down

0 comments on commit 0f3a88b

Please sign in to comment.