Skip to content

Commit f8c5042

Browse files
refackMylesBorins
authored andcommitted
tools: include exit code in TAP log
PR-URL: #19855 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 11e53cd commit f8c5042

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/test.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ def HasRun(self, output):
255255

256256
class TapProgressIndicator(SimpleProgressIndicator):
257257

258-
def _printDiagnostic(self, traceback, severity):
259-
logger.info(' severity: %s', severity)
258+
def _printDiagnostic(self):
259+
logger.info(' severity: %s', self.severity)
260+
self.exitcode and logger.info(' exitcode: %s', self.exitcode)
260261
logger.info(' stack: |-')
261262

262-
for l in traceback.splitlines():
263+
for l in self.traceback.splitlines():
263264
logger.info(' ' + l)
264265

265266
def Starting(self):
@@ -274,6 +275,7 @@ def HasRun(self, output):
274275
self._done += 1
275276
self.traceback = ''
276277
self.severity = 'ok'
278+
self.exitcode = ''
277279

278280
# Print test name as (for example) "parallel/test-assert". Tests that are
279281
# scraped from the addons documentation are all named test.js, making it
@@ -285,7 +287,8 @@ def HasRun(self, output):
285287
if output.UnexpectedOutput():
286288
status_line = 'not ok %i %s' % (self._done, command)
287289
self.severity = 'fail'
288-
self.traceback = "exit code: " + output.output.exit_code + "\n" + output.output.stdout + output.output.stderr
290+
self.exitcode = output.output.exit_code
291+
self.traceback = output.output.stdout + output.output.stderr
289292

290293
if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
291294
status_line = status_line + ' # TODO : Fix flaky test'
@@ -331,7 +334,7 @@ def HasRun(self, output):
331334
if self.severity is not 'ok' or self.traceback is not '':
332335
if output.HasTimedOut():
333336
self.traceback = 'timeout'
334-
self._printDiagnostic(self.traceback, self.severity)
337+
self._printDiagnostic()
335338
logger.info(' ...')
336339

337340
def Done(self):

0 commit comments

Comments
 (0)