From bdcd041890bf6b69b99a6b5870e16a5e85ecafd3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 6 Apr 2018 10:41:29 -0700 Subject: [PATCH 1/2] tools: include exit code in test failures Include the exit code in test failures. This will give us more information during the currently-puzzling failures that provide no information in CI such as: ``` 03:10:10 not ok 563 parallel/test-fs-truncate 03:10:10 --- 03:10:10 duration_ms: 1.119 03:10:10 severity: fail 03:10:10 stack: |- 03:10:10 ... ``` --- tools/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index 230774b25619da..3b63780170f900 100755 --- a/tools/test.py +++ b/tools/test.py @@ -284,7 +284,7 @@ def HasRun(self, output): if output.UnexpectedOutput(): status_line = 'not ok %i %s' % (self._done, command) self.severity = 'fail' - self.traceback = output.output.stdout + output.output.stderr + self.traceback = "exit code: " + output.output.exit_code + "\n" + 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' From 0a797a9180a296d1df17413ec2fdfb2020e42fda Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 6 Apr 2018 17:55:50 -0400 Subject: [PATCH 2/2] tools: include exit code in TAP log --- tools/test.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/test.py b/tools/test.py index 3b63780170f900..0a142f602be4e7 100755 --- a/tools/test.py +++ b/tools/test.py @@ -254,11 +254,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): @@ -273,6 +274,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 @@ -284,7 +286,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' @@ -330,7 +333,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):