@@ -256,11 +256,15 @@ def HasRun(self, output):
256
256
257
257
class TapProgressIndicator (SimpleProgressIndicator ):
258
258
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 )
262
265
263
266
def Starting (self ):
267
+ logger .info ('TAP version 13' )
264
268
logger .info ('1..%i' % len (self .cases ))
265
269
self ._done = 0
266
270
@@ -269,6 +273,8 @@ def AboutToRun(self, case):
269
273
270
274
def HasRun (self , output ):
271
275
self ._done += 1
276
+ self .traceback = ''
277
+ self .severity = 'ok'
272
278
273
279
# Print test name as (for example) "parallel/test-assert". Tests that are
274
280
# scraped from the addons documentation are all named test.js, making it
@@ -281,19 +287,23 @@ def HasRun(self, output):
281
287
282
288
if output .UnexpectedOutput ():
283
289
status_line = 'not ok %i %s' % (self ._done , command )
290
+ self .severity = 'fail'
291
+ self .traceback = output .output .stdout + output .output .stderr
292
+
284
293
if FLAKY in output .test .outcomes and self .flaky_tests_mode == DONTCARE :
285
294
status_line = status_line + ' # TODO : Fix flaky test'
295
+ self .severity = 'flaky'
296
+
286
297
logger .info (status_line )
287
- self ._printDiagnostic ("\n " .join (output .diagnostic ))
288
298
289
299
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!\n exit code: " + PrintCrashed (exit_code )
291
303
292
304
if output .HasTimedOut ():
293
- self ._printDiagnostic ( 'TIMEOUT' )
305
+ self .severity = 'fail'
294
306
295
- self ._printDiagnostic (output .output .stderr )
296
- self ._printDiagnostic (output .output .stdout )
297
307
else :
298
308
skip = skip_regex .search (output .output .stdout )
299
309
if skip :
@@ -304,7 +314,11 @@ def HasRun(self, output):
304
314
if FLAKY in output .test .outcomes :
305
315
status_line = status_line + ' # TODO : Fix flaky test'
306
316
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
+
308
322
309
323
duration = output .test .duration
310
324
@@ -313,7 +327,12 @@ def HasRun(self, output):
313
327
(duration .seconds + duration .days * 24 * 3600 ) * 10 ** 6 ) / 10 ** 6
314
328
315
329
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 )
317
336
logger .info (' ...' )
318
337
319
338
def Done (self ):
0 commit comments