Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: print failed JS/parallel tests #45960

Merged
merged 5 commits into from Dec 27, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 16 additions & 7 deletions tools/test.py
Expand Up @@ -147,7 +147,7 @@ def PrintFailureHeader(self, test):
})
print("Path: %s" % "/".join(test.path))

def Run(self, tasks):
def Run(self, tasks) -> dict:
GeoffreyBooth marked this conversation as resolved.
Show resolved Hide resolved
self.Starting()
threads = []
# Spawn N-1 threads and then use this thread as the last one.
Expand All @@ -172,7 +172,10 @@ def Run(self, tasks):
# ...and then reraise the exception to bail out
raise
self.Done()
return not self.failed
return {
'allPassed': not self.failed,
'failed': self.failed,
}
GeoffreyBooth marked this conversation as resolved.
Show resolved Hide resolved

def RunSingle(self, parallel, thread_id):
while not self.shutdown_event.is_set():
Expand Down Expand Up @@ -479,6 +482,7 @@ def HasRun(self, output):
print("--- %s ---" % PrintCrashed(output.output.exit_code))
if output.HasTimedOut():
print("--- TIMEOUT ---")
print("\n") # Two blank lines between failures, for visual separation

def Truncate(self, str, length):
if length and (len(str) > (length - 3)):
Expand Down Expand Up @@ -1757,10 +1761,8 @@ def should_keep(case):
else:
try:
start = time.time()
if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests, options.measure_flakiness):
result = 0
else:
result = 1
result = RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests, options.measure_flakiness)
exitcode = 0 if result['allPassed'] else 1
duration = time.time() - start
except KeyboardInterrupt:
print("Interrupted")
Expand All @@ -1777,7 +1779,14 @@ def should_keep(case):
t = FormatTimedelta(entry.duration)
sys.stderr.write("%4i (%s) %s\n" % (i, t, entry.GetLabel()))

return result
if result['allPassed']:
GeoffreyBooth marked this conversation as resolved.
Show resolved Hide resolved
print("\nAll tests passed.")
else:
print("\nFailed tests:")
for failure in result['failed']:
print(EscapeCommand(failure.command))

return exitcode


if __name__ == '__main__':
Expand Down