Skip to content

Commit 76b8d81

Browse files
santigimenoMylesBorins
authored andcommitted
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: #7859 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 9892a5d commit 76b8d81

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tools/test.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def Done(self):
197197
print failed.output.stdout.strip()
198198
print "Command: %s" % EscapeCommand(failed.command)
199199
if failed.HasCrashed():
200-
print "--- CRASHED ---"
200+
print "--- %s ---" % PrintCrashed(failed.output.exit_code)
201201
if failed.HasTimedOut():
202202
print "--- TIMEOUT ---"
203203
if len(self.failed) == 0:
@@ -286,6 +286,9 @@ def HasRun(self, output):
286286
logger.info(status_line)
287287
self._printDiagnostic("\n".join(output.diagnostic))
288288

289+
if output.HasCrashed():
290+
self._printDiagnostic(PrintCrashed(output.output.exit_code))
291+
289292
if output.HasTimedOut():
290293
self._printDiagnostic('TIMEOUT')
291294

@@ -346,7 +349,7 @@ def HasRun(self, output):
346349
print self.templates['stderr'] % stderr
347350
print "Command: %s" % EscapeCommand(output.command)
348351
if output.HasCrashed():
349-
print "--- CRASHED ---"
352+
print "--- %s ---" % PrintCrashed(output.output.exit_code)
350353
if output.HasTimedOut():
351354
print "--- TIMEOUT ---"
352355

@@ -1491,6 +1494,13 @@ def FormatTime(d):
14911494
return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis)
14921495

14931496

1497+
def PrintCrashed(code):
1498+
if utils.IsWindows():
1499+
return "CRASHED"
1500+
else:
1501+
return "CRASHED (Signal: %d)" % -code
1502+
1503+
14941504
def Main():
14951505
parser = BuildOptions()
14961506
(options, args) = parser.parse_args()

0 commit comments

Comments
 (0)