From ec773ad78e91ccc5cb5556204c1684315682c855 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sat, 24 Apr 2021 18:22:55 -0700 Subject: [PATCH] Ensure stdout and stderr from failed test runs are reported from `run_tests.py`. We print stdout and stderr only from successful test or benchmark runs. Because of the raised exception, a non-zero exit code would gobble up output from these runs. This is actually the situation where this information would be most useful. Print all the information we have before raising the exception. --- testing/run_tests.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index cf095400de4ee..f37904cee616a 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -46,7 +46,18 @@ def RunCmd(cmd, forbidden_output=[], **kwargs): if process.returncode != 0: PrintDivider('!') - raise Exception('Command "%s" exited with code %d' % (command_string, process.returncode)) + + print('Failed Command:\n\n%s\n\nExit Code: %d\n' % (command_string, process.returncode)) + + if stdout: + print('STDOUT: \n%s' % stdout) + + if stderr: + print('STDERR: \n%s' % stderr) + + PrintDivider('!') + + raise Exception('Command "%s" exited with code %d.' % (command_string, process.returncode)) if stdout or stderr: print(stdout)