2929
3030
3131from __future__ import print_function
32+ from typing import Dict
3233import logging
3334import optparse
3435import os
@@ -147,7 +148,7 @@ def PrintFailureHeader(self, test):
147148 })
148149 print("Path: %s" % "/".join(test.path))
149150
150- def Run(self, tasks):
151+ def Run(self, tasks) -> Dict :
151152 self.Starting()
152153 threads = []
153154 # Spawn N-1 threads and then use this thread as the last one.
@@ -172,7 +173,10 @@ def Run(self, tasks):
172173 # ...and then reraise the exception to bail out
173174 raise
174175 self.Done()
175- return not self.failed
176+ return {
177+ 'allPassed': not self.failed,
178+ 'failed': self.failed,
179+ }
176180
177181 def RunSingle(self, parallel, thread_id):
178182 while not self.shutdown_event.is_set():
@@ -479,6 +483,7 @@ def HasRun(self, output):
479483 print("--- %s ---" % PrintCrashed(output.output.exit_code))
480484 if output.HasTimedOut():
481485 print("--- TIMEOUT ---")
486+ print("\n") # Two blank lines between failures, for visual separation
482487
483488 def Truncate(self, str, length):
484489 if length and (len(str) > (length - 3)):
@@ -1757,10 +1762,8 @@ def should_keep(case):
17571762 else:
17581763 try:
17591764 start = time.time()
1760- if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests, options.measure_flakiness):
1761- result = 0
1762- else:
1763- result = 1
1765+ result = RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests, options.measure_flakiness)
1766+ exitcode = 0 if result['allPassed'] else 1
17641767 duration = time.time() - start
17651768 except KeyboardInterrupt:
17661769 print("Interrupted")
@@ -1777,7 +1780,14 @@ def should_keep(case):
17771780 t = FormatTimedelta(entry.duration)
17781781 sys.stderr.write("%4i (%s) %s\n" % (i, t, entry.GetLabel()))
17791782
1780- return result
1783+ if result['allPassed']:
1784+ print("\nAll tests passed.")
1785+ else:
1786+ print("\nFailed tests:")
1787+ for failure in result['failed']:
1788+ print(EscapeCommand(failure.command))
1789+
1790+ return exitcode
17811791
17821792
17831793if __name__ == '__main__':
0 commit comments