Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 747013b

Browse filesBrowse files
jbergstroemMyles Borins
authored andcommitted
test: output tap13 instead of almost-tap
Produce a tap13-compatible output which makes it simpler to parse. Output is still readable by the jenkins tap plugin. PR-URL: #9262 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Myles Borins <myles.borins@gmail.com>
1 parent eb34f68 commit 747013b
Copy full SHA for 747013b

File tree

Expand file treeCollapse file tree

1 file changed

+29
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+29
-10
lines changed
Open diff view settings
Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+29-10Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,15 @@ def HasRun(self, output):
256256

257257
class TapProgressIndicator(SimpleProgressIndicator):
258258

259-
def _printDiagnostic(self, messages):
260-
for l in messages.splitlines():
261-
logger.info('# ' + l)
259+
def _printDiagnostic(self, traceback, severity):
260+
logger.info(' severity: %s', severity)
261+
logger.info(' stack: |-')
262+
263+
for l in traceback.splitlines():
264+
logger.info(' ' + l)
262265

263266
def Starting(self):
267+
logger.info('TAP version 13')
264268
logger.info('1..%i' % len(self.cases))
265269
self._done = 0
266270

@@ -269,6 +273,8 @@ def AboutToRun(self, case):
269273

270274
def HasRun(self, output):
271275
self._done += 1
276+
self.traceback = ''
277+
self.severity = 'ok'
272278

273279
# Print test name as (for example) "parallel/test-assert". Tests that are
274280
# scraped from the addons documentation are all named test.js, making it
@@ -281,19 +287,23 @@ def HasRun(self, output):
281287

282288
if output.UnexpectedOutput():
283289
status_line = 'not ok %i %s' % (self._done, command)
290+
self.severity = 'fail'
291+
self.traceback = output.output.stdout + output.output.stderr
292+
284293
if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
285294
status_line = status_line + ' # TODO : Fix flaky test'
295+
self.severity = 'flaky'
296+
286297
logger.info(status_line)
287-
self._printDiagnostic("\n".join(output.diagnostic))
288298

289299
if output.HasCrashed():
290-
self._printDiagnostic(PrintCrashed(output.output.exit_code))
300+
self.severity = 'crashed'
301+
exit_code = output.output.exit_code
302+
self.traceback = "oh no!\nexit code: " + PrintCrashed(exit_code)
291303

292304
if output.HasTimedOut():
293-
self._printDiagnostic('TIMEOUT')
305+
self.severity = 'fail'
294306

295-
self._printDiagnostic(output.output.stderr)
296-
self._printDiagnostic(output.output.stdout)
297307
else:
298308
skip = skip_regex.search(output.output.stdout)
299309
if skip:
@@ -304,7 +314,11 @@ def HasRun(self, output):
304314
if FLAKY in output.test.outcomes:
305315
status_line = status_line + ' # TODO : Fix flaky test'
306316
logger.info(status_line)
307-
self._printDiagnostic("\n".join(output.diagnostic))
317+
318+
if output.diagnostic:
319+
self.severity = 'ok'
320+
self.traceback = output.diagnostic
321+
308322

309323
duration = output.test.duration
310324

@@ -313,7 +327,12 @@ def HasRun(self, output):
313327
(duration.seconds + duration.days * 24 * 3600) * 10**6) / 10**6
314328

315329
logger.info(' ---')
316-
logger.info(' duration_ms: %d.%d' % (total_seconds, duration.microseconds / 1000))
330+
logger.info(' duration_ms: %d.%d' %
331+
(total_seconds, duration.microseconds / 1000))
332+
if self.severity is not 'ok' or self.traceback is not '':
333+
if output.HasTimedOut():
334+
self.traceback = 'timeout'
335+
self._printDiagnostic(self.traceback, self.severity)
317336
logger.info(' ...')
318337

319338
def Done(self):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.