Skip to content

Commit df4ef63

Browse files
committed
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 bc464a8 commit df4ef63

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
@@ -196,7 +196,7 @@ def Done(self):
196196
print failed.output.stdout.strip()
197197
print "Command: %s" % EscapeCommand(failed.command)
198198
if failed.HasCrashed():
199-
print "--- CRASHED ---"
199+
print "--- %s ---" % PrintCrashed(failed.output.exit_code)
200200
if failed.HasTimedOut():
201201
print "--- TIMEOUT ---"
202202
if len(self.failed) == 0:
@@ -285,6 +285,9 @@ def HasRun(self, output):
285285
logger.info(status_line)
286286
self._printDiagnostic("\n".join(output.diagnostic))
287287

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

@@ -347,7 +350,7 @@ def HasRun(self, output):
347350
print self.templates['stderr'] % stderr
348351
print "Command: %s" % EscapeCommand(output.command)
349352
if output.HasCrashed():
350-
print "--- CRASHED ---"
353+
print "--- %s ---" % PrintCrashed(output.output.exit_code)
351354
if output.HasTimedOut():
352355
print "--- TIMEOUT ---"
353356

@@ -1476,6 +1479,13 @@ def FormatTime(d):
14761479
return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis)
14771480

14781481

1482+
def PrintCrashed(code):
1483+
if utils.IsWindows():
1484+
return "CRASHED"
1485+
else:
1486+
return "CRASHED (Signal: %d)" % -code
1487+
1488+
14791489
def Main():
14801490
parser = BuildOptions()
14811491
(options, args) = parser.parse_args()

0 commit comments

Comments
 (0)