Skip to content

Commit 994ca4b

Browse files
committed
tests/run-tests.py: Accumulate all test results in one list.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 26930ce commit 994ca4b

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

tests/run-tests.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,7 @@ def run_script_on_remote_target(self, args, test_file, is_special):
605605
def run_tests(pyb, tests, args, result_dir, num_threads=1):
606606
test_count = ThreadSafeCounter()
607607
testcase_count = ThreadSafeCounter()
608-
passed_tests = ThreadSafeCounter([])
609-
failed_tests = ThreadSafeCounter([])
610-
skipped_tests = ThreadSafeCounter([])
608+
test_results = ThreadSafeCounter([])
611609

612610
skip_tests = set()
613611
skip_native = False
@@ -896,7 +894,7 @@ def run_one_test(test_file):
896894

897895
if skip_it:
898896
print("skip ", test_file)
899-
skipped_tests.append((test_name, test_file))
897+
test_results.append((test_name, test_file, "skip", ""))
900898
return
901899

902900
# Run the test on the MicroPython target.
@@ -911,7 +909,7 @@ def run_one_test(test_file):
911909
# start-up code (eg boot.py) when preparing to run the next test.
912910
pyb.read_until(1, b"raw REPL; CTRL-B to exit\r\n")
913911
print("skip ", test_file)
914-
skipped_tests.append((test_name, test_file))
912+
test_results.append((test_name, test_file, "skip", ""))
915913
return
916914

917915
# Look at the output of the test to see if unittest was used.
@@ -994,7 +992,7 @@ def run_one_test(test_file):
994992
# Print test summary, update counters, and save .exp/.out files if needed.
995993
if test_passed:
996994
print("pass ", test_file, extra_info)
997-
passed_tests.append((test_name, test_file))
995+
test_results.append((test_name, test_file, "pass", ""))
998996
rm_f(filename_expected)
999997
rm_f(filename_mupy)
1000998
else:
@@ -1006,7 +1004,7 @@ def run_one_test(test_file):
10061004
rm_f(filename_expected) # in case left over from previous failed run
10071005
with open(filename_mupy, "wb") as f:
10081006
f.write(output_mupy)
1009-
failed_tests.append((test_name, test_file))
1007+
test_results.append((test_name, test_file, "fail", ""))
10101008

10111009
test_count.increment()
10121010

@@ -1035,9 +1033,10 @@ def run_one_test(test_file):
10351033
print(line)
10361034
sys.exit(1)
10371035

1038-
passed_tests = sorted(passed_tests.value)
1039-
skipped_tests = sorted(skipped_tests.value)
1040-
failed_tests = sorted(failed_tests.value)
1036+
test_results = test_results.value
1037+
passed_tests = list(r for r in test_results if r[2] == "pass")
1038+
skipped_tests = list(r for r in test_results if r[2] == "skip")
1039+
failed_tests = list(r for r in test_results if r[2] == "fail")
10411040

10421041
print(
10431042
"{} tests performed ({} individual testcases)".format(
@@ -1072,12 +1071,8 @@ def to_json(obj):
10721071
# The arguments passed on the command-line.
10731072
"args": vars(args),
10741073
# A list of all results of the form [(test, result, reason), ...].
1075-
"results": (
1076-
list([test[1], "pass", ""] for test in passed_tests)
1077-
+ list([test[1], "skip", ""] for test in skipped_tests)
1078-
+ list([test[1], "fail", ""] for test in failed_tests)
1079-
),
1080-
# A list of failed tests. This is deprecated, one should the results above.
1074+
"results": list(test[1:] for test in test_results),
1075+
# A list of failed tests. This is deprecated, use the "results" above instead.
10811076
"failed_tests": [test[1] for test in failed_tests],
10821077
},
10831078
f,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy