Skip to content

Commit

Permalink
tools,test: show signal code when test crashes
Browse files Browse the repository at this point in the history
On every platform but `Windows`. Also, print the crash information when
using the tap reporter.

PR-URL: #7859
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
santigimeno authored and MylesBorins committed Oct 26, 2016
1 parent 9892a5d commit 76b8d81
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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 ---"

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 76b8d81

Please sign in to comment.