@@ -255,11 +255,15 @@ def HasRun(self, output):
255
255
256
256
class TapProgressIndicator (SimpleProgressIndicator ):
257
257
258
- def _printDiagnostic (self , messages ):
259
- for l in messages .splitlines ():
260
- logger .info ('# ' + l )
258
+ def _printDiagnostic (self , traceback , severity ):
259
+ logger .info (' severity: %s' , severity )
260
+ logger .info (' stack: |-' )
261
+
262
+ for l in traceback .splitlines ():
263
+ logger .info (' ' + l )
261
264
262
265
def Starting (self ):
266
+ logger .info ('TAP version 13' )
263
267
logger .info ('1..%i' % len (self .cases ))
264
268
self ._done = 0
265
269
@@ -268,6 +272,8 @@ def AboutToRun(self, case):
268
272
269
273
def HasRun (self , output ):
270
274
self ._done += 1
275
+ self .traceback = ''
276
+ self .severity = 'ok'
271
277
272
278
# Print test name as (for example) "parallel/test-assert". Tests that are
273
279
# scraped from the addons documentation are all named test.js, making it
@@ -280,19 +286,23 @@ def HasRun(self, output):
280
286
281
287
if output .UnexpectedOutput ():
282
288
status_line = 'not ok %i %s' % (self ._done , command )
289
+ self .severity = 'fail'
290
+ self .traceback = output .output .stdout + output .output .stderr
291
+
283
292
if FLAKY in output .test .outcomes and self .flaky_tests_mode == DONTCARE :
284
293
status_line = status_line + ' # TODO : Fix flaky test'
294
+ self .severity = 'flaky'
295
+
285
296
logger .info (status_line )
286
- self ._printDiagnostic ("\n " .join (output .diagnostic ))
287
297
288
298
if output .HasCrashed ():
289
- self ._printDiagnostic (PrintCrashed (output .output .exit_code ))
299
+ self .severity = 'crashed'
300
+ exit_code = output .output .exit_code
301
+ self .traceback = "oh no!\n exit code: " + PrintCrashed (exit_code )
290
302
291
303
if output .HasTimedOut ():
292
- self ._printDiagnostic ( 'TIMEOUT' )
304
+ self .severity = 'fail'
293
305
294
- self ._printDiagnostic (output .output .stderr )
295
- self ._printDiagnostic (output .output .stdout )
296
306
else :
297
307
skip = skip_regex .search (output .output .stdout )
298
308
if skip :
@@ -303,7 +313,11 @@ def HasRun(self, output):
303
313
if FLAKY in output .test .outcomes :
304
314
status_line = status_line + ' # TODO : Fix flaky test'
305
315
logger .info (status_line )
306
- self ._printDiagnostic ("\n " .join (output .diagnostic ))
316
+
317
+ if output .diagnostic :
318
+ self .severity = 'ok'
319
+ self .traceback = output .diagnostic
320
+
307
321
308
322
duration = output .test .duration
309
323
@@ -314,7 +328,12 @@ def HasRun(self, output):
314
328
# duration_ms is measured in seconds and is read as such by TAP parsers.
315
329
# It should read as "duration including ms" rather than "duration in ms"
316
330
logger .info (' ---' )
317
- logger .info (' duration_ms: %d.%d' % (total_seconds , duration .microseconds / 1000 ))
331
+ logger .info (' duration_ms: %d.%d' %
332
+ (total_seconds , duration .microseconds / 1000 ))
333
+ if self .severity is not 'ok' or self .traceback is not '' :
334
+ if output .HasTimedOut ():
335
+ self .traceback = 'timeout'
336
+ self ._printDiagnostic (self .traceback , self .severity )
318
337
logger .info (' ...' )
319
338
320
339
def Done (self ):
0 commit comments