MCPcopy Index your code
hub / github.com/nodejs/node / HasRun

Method HasRun

tools/test.py:354–411  ·  view source on GitHub ↗
(self, output)

Source from the content-addressed store, hash-verified

352 pass
353
354 def HasRun(self, output):
355 self._done += 1
356 self.traceback = ''
357 self.severity = 'ok'
358 self.exitcode = ''
359
360 # Print test name as (for example) "parallel/test-assert". Tests that are
361 # scraped from the addons documentation are all named test.js, making it
362 # hard to decipher what test is running when only the filename is printed.
363 prefix = abspath(join(dirname(__file__), '../test')) + os.sep
364 command = output.command[-1]
365 command = NormalizePath(command, prefix)
366
367 if output.UnexpectedOutput():
368 status_line = 'not ok %i %s' % (self._done, command)
369 self.severity = 'fail'
370 self.exitcode = output.output.exit_code
371 self.traceback = output.output.stdout + output.output.stderr
372
373 if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
374 status_line = status_line + ' # TODO : Fix flaky test'
375 self.severity = 'flaky'
376
377 logger.info(status_line)
378
379 if output.HasCrashed():
380 self.severity = 'crashed'
381
382 elif output.HasTimedOut():
383 self.severity = 'fail'
384
385 else:
386 skip = skip_regex.search(output.output.stdout)
387 if skip:
388 logger.info(
389 'ok %i %s # skip %s' % (self._done, command, skip.group(1)))
390 else:
391 status_line = 'ok %i %s' % (self._done, command)
392 if FLAKY in output.test.outcomes:
393 status_line = status_line + ' # TODO : Fix flaky test'
394 logger.info(status_line)
395
396 if output.diagnostic:
397 self.severity = 'ok'
398 if isinstance(output.diagnostic, list):
399 self.traceback = '\n'.join(output.diagnostic)
400 else:
401 self.traceback = output.diagnostic
402
403
404 duration = output.test.duration
405 logger.info(' ---')
406 logger.info(' duration_ms: %.5f' % (duration / timedelta(milliseconds=1)))
407 if self.severity != 'ok' or self.traceback != '':
408 if output.HasTimedOut():
409 self.traceback = 'timeout\n' + output.output.stdout + output.output.stderr
410 self._printDiagnostic()
411 logger.info(' ...')

Callers 1

RunSingleMethod · 0.45

Calls 11

_printDiagnosticMethod · 0.95
joinFunction · 0.90
dirnameFunction · 0.90
abspathFunction · 0.85
NormalizePathFunction · 0.85
UnexpectedOutputMethod · 0.80
infoMethod · 0.80
HasCrashedMethod · 0.45
HasTimedOutMethod · 0.45
searchMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected