Skip to content

Commit

Permalink
tools: include exit code in TAP log
Browse files Browse the repository at this point in the history
PR-URL: #19855
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
  • Loading branch information
refack authored and MylesBorins committed Aug 17, 2018
1 parent 11e53cd commit f8c5042
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,12 @@ def HasRun(self, output):

class TapProgressIndicator(SimpleProgressIndicator):

def _printDiagnostic(self, traceback, severity):
logger.info(' severity: %s', severity)
def _printDiagnostic(self):
logger.info(' severity: %s', self.severity)
self.exitcode and logger.info(' exitcode: %s', self.exitcode)
logger.info(' stack: |-')

for l in traceback.splitlines():
for l in self.traceback.splitlines():
logger.info(' ' + l)

def Starting(self):
Expand All @@ -274,6 +275,7 @@ def HasRun(self, output):
self._done += 1
self.traceback = ''
self.severity = 'ok'
self.exitcode = ''

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

if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
status_line = status_line + ' # TODO : Fix flaky test'
Expand Down Expand Up @@ -331,7 +334,7 @@ def HasRun(self, output):
if self.severity is not 'ok' or self.traceback is not '':
if output.HasTimedOut():
self.traceback = 'timeout'
self._printDiagnostic(self.traceback, self.severity)
self._printDiagnostic()
logger.info(' ...')

def Done(self):
Expand Down

0 comments on commit f8c5042

Please sign in to comment.