Skip to content

Commit 41519fd

Browse files
committed
test: add TAP diagnostic message for retried tests
Tests on SmartOS are sometimes retried due to a SmartOS issue on CI. When this happens, a TAP diagnostic message is written. PR-URL: #3960 Reviewed-By: Fedor Indutny <[email protected]>
1 parent 8d37bbe commit 41519fd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tools/test.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def RunSingle(self, parallel, thread_id):
145145
sys.platform == 'sunos5' and
146146
'ECONNREFUSED' in output.output.stderr):
147147
output = case.Run()
148+
output.diagnostic.append('ECONNREFUSED received, test retried')
148149
case.duration = (datetime.now() - start)
149150
except IOError, e:
150151
return
@@ -255,6 +256,10 @@ def HasRun(self, output):
255256

256257
class TapProgressIndicator(SimpleProgressIndicator):
257258

259+
def _printDiagnostic(self, messages):
260+
for l in messages.splitlines():
261+
logger.info('# ' + l)
262+
258263
def Starting(self):
259264
logger.info('1..%i' % len(self.cases))
260265
self._done = 0
@@ -270,14 +275,13 @@ def HasRun(self, output):
270275
if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
271276
status_line = status_line + ' # TODO : Fix flaky test'
272277
logger.info(status_line)
278+
self._printDiagnostic("\n".join(output.diagnostic))
273279

274280
if output.HasTimedOut():
275-
logger.info('# TIMEOUT')
281+
self._printDiagnostic('TIMEOUT')
276282

277-
for l in output.output.stderr.splitlines():
278-
logger.info('#' + l)
279-
for l in output.output.stdout.splitlines():
280-
logger.info('#' + l)
283+
self._printDiagnostic(output.output.stderr)
284+
self._printDiagnostic(output.output.stdout)
281285
else:
282286
skip = skip_regex.search(output.output.stdout)
283287
if skip:
@@ -288,6 +292,7 @@ def HasRun(self, output):
288292
if FLAKY in output.test.outcomes:
289293
status_line = status_line + ' # TODO : Fix flaky test'
290294
logger.info(status_line)
295+
self._printDiagnostic("\n".join(output.diagnostic))
291296

292297
duration = output.test.duration
293298

@@ -490,6 +495,7 @@ def __init__(self, test, command, output, store_unexpected_output):
490495
self.command = command
491496
self.output = output
492497
self.store_unexpected_output = store_unexpected_output
498+
self.diagnostic = []
493499

494500
def UnexpectedOutput(self):
495501
if self.HasCrashed():

0 commit comments

Comments
 (0)