From 9e9228d258c1db2d1f9cd65703e69bb108a6a1dc Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sun, 24 Jul 2016 08:24:48 +0200 Subject: [PATCH] tools,test: show signal code when test crashes On every platform but `Windows`. Also, print the crash information when using the tap reporter. PR-URL: https://github.com/nodejs/node/pull/7859 Reviewed-By: Ben Noordhuis --- tools/test.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/test.py b/tools/test.py index 49971fd6e2f290..97880fb3cd2667 100755 --- a/tools/test.py +++ b/tools/test.py @@ -197,7 +197,7 @@ def Done(self): print failed.output.stdout.strip() print "Command: %s" % EscapeCommand(failed.command) if failed.HasCrashed(): - print "--- CRASHED ---" + print "--- %s ---" % PrintCrashed(failed.output.exit_code) if failed.HasTimedOut(): print "--- TIMEOUT ---" if len(self.failed) == 0: @@ -286,6 +286,9 @@ def HasRun(self, output): logger.info(status_line) self._printDiagnostic("\n".join(output.diagnostic)) + if output.HasCrashed(): + self._printDiagnostic(PrintCrashed(output.output.exit_code)) + if output.HasTimedOut(): self._printDiagnostic('TIMEOUT') @@ -346,7 +349,7 @@ def HasRun(self, output): print self.templates['stderr'] % stderr print "Command: %s" % EscapeCommand(output.command) if output.HasCrashed(): - print "--- CRASHED ---" + print "--- %s ---" % PrintCrashed(output.output.exit_code) if output.HasTimedOut(): print "--- TIMEOUT ---" @@ -1491,6 +1494,13 @@ def FormatTime(d): return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) +def PrintCrashed(code): + if utils.IsWindows(): + return "CRASHED" + else: + return "CRASHED (Signal: %d)" % -code + + def Main(): parser = BuildOptions() (options, args) = parser.parse_args()