@@ -605,7 +605,7 @@ def run_script_on_remote_target(self, args, test_file, is_special):
605605def run_tests (pyb , tests , args , result_dir , num_threads = 1 ):
606606 test_count = ThreadSafeCounter ()
607607 testcase_count = ThreadSafeCounter ()
608- passed_count = ThreadSafeCounter ()
608+ passed_tests = ThreadSafeCounter ([] )
609609 failed_tests = ThreadSafeCounter ([])
610610 skipped_tests = ThreadSafeCounter ([])
611611
@@ -896,7 +896,7 @@ def run_one_test(test_file):
896896
897897 if skip_it :
898898 print ("skip " , test_file )
899- skipped_tests .append (test_name )
899+ skipped_tests .append (( test_name , test_file ) )
900900 return
901901
902902 # Run the test on the MicroPython target.
@@ -911,7 +911,7 @@ def run_one_test(test_file):
911911 # start-up code (eg boot.py) when preparing to run the next test.
912912 pyb .read_until (1 , b"raw REPL; CTRL-B to exit\r \n " )
913913 print ("skip " , test_file )
914- skipped_tests .append (test_name )
914+ skipped_tests .append (( test_name , test_file ) )
915915 return
916916
917917 # Look at the output of the test to see if unittest was used.
@@ -994,7 +994,7 @@ def run_one_test(test_file):
994994 # Print test summary, update counters, and save .exp/.out files if needed.
995995 if test_passed :
996996 print ("pass " , test_file , extra_info )
997- passed_count . increment ( )
997+ passed_tests . append (( test_name , test_file ) )
998998 rm_f (filename_expected )
999999 rm_f (filename_mupy )
10001000 else :
@@ -1035,17 +1035,30 @@ def run_one_test(test_file):
10351035 print (line )
10361036 sys .exit (1 )
10371037
1038+ passed_tests = sorted (passed_tests .value )
1039+ skipped_tests = sorted (skipped_tests .value )
1040+ failed_tests = sorted (failed_tests .value )
1041+
10381042 print (
10391043 "{} tests performed ({} individual testcases)" .format (
10401044 test_count .value , testcase_count .value
10411045 )
10421046 )
1043- print ("{} tests passed" .format (passed_count . value ))
1047+ print ("{} tests passed" .format (len ( passed_tests ) ))
10441048
1045- skipped_tests = sorted (skipped_tests .value )
10461049 if len (skipped_tests ) > 0 :
1047- print ("{} tests skipped: {}" .format (len (skipped_tests ), " " .join (skipped_tests )))
1048- failed_tests = sorted (failed_tests .value )
1050+ print (
1051+ "{} tests skipped: {}" .format (
1052+ len (skipped_tests ), " " .join (test [0 ] for test in skipped_tests )
1053+ )
1054+ )
1055+
1056+ if len (failed_tests ) > 0 :
1057+ print (
1058+ "{} tests failed: {}" .format (
1059+ len (failed_tests ), " " .join (test [0 ] for test in failed_tests )
1060+ )
1061+ )
10491062
10501063 # Serialize regex added by append_filter.
10511064 def to_json (obj ):
@@ -1055,21 +1068,18 @@ def to_json(obj):
10551068
10561069 with open (os .path .join (result_dir , RESULTS_FILE ), "w" ) as f :
10571070 json .dump (
1058- {"args" : vars (args ), "failed_tests" : [test [1 ] for test in failed_tests ]},
1071+ {
1072+ "args" : vars (args ),
1073+ "passed_tests" : [test [1 ] for test in passed_tests ],
1074+ "skipped_tests" : [test [1 ] for test in skipped_tests ],
1075+ "failed_tests" : [test [1 ] for test in failed_tests ],
1076+ },
10591077 f ,
10601078 default = to_json ,
10611079 )
10621080
1063- if len (failed_tests ) > 0 :
1064- print (
1065- "{} tests failed: {}" .format (
1066- len (failed_tests ), " " .join (test [0 ] for test in failed_tests )
1067- )
1068- )
1069- return False
1070-
1071- # all tests succeeded
1072- return True
1081+ # Return True only if all tests succeeded.
1082+ return len (failed_tests ) == 0
10731083
10741084
10751085class append_filter (argparse .Action ):
0 commit comments