MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / run_tests

Function run_tests

test/runner.py:461–495  ·  view source on GitHub ↗
(options, suite)

Source from the content-addressed store, hash-verified

459
460
461def run_tests(options, suite):
462 # Run the discovered tests
463 if utils.get_env_bool('CI'):
464 # output fd must remain open until after testRunner.run() below
465 output = open('out/test-results.xml', 'wb')
466 import xmlrunner # type: ignore
467 testRunner = xmlrunner.XMLTestRunner(output=output, verbosity=2,
468 failfast=options.failfast)
469 print('Writing XML test output to ' + os.path.abspath(output.name))
470 elif options.ansi and not options.verbose:
471 # When not in verbose mode and ansi color output is available use our nice single-line
472 # result display.
473 testRunner = SingleLineTestRunner(failfast=options.failfast)
474 else:
475 if not options.ansi:
476 print('using verbose test runner (ANSI not available)')
477 else:
478 print('using verbose test runner (verbose output requested)')
479 testRunner = ColorTextRunner(failfast=options.failfast)
480
481 run_start_time = time.perf_counter()
482
483 errlog('Running %s tests' % suite.countTestCases())
484 res = testRunner.run(suite)
485 num_failures = len(res.errors) + len(res.failures) + len(res.unexpectedSuccesses)
486
487 total_run_time = time.perf_counter() - run_start_time
488 if hasattr(res, 'core_time'):
489 errlog('Total core time: %.3fs. Wallclock time: %.3fs. Parallelization: %.2fx.' % (res.core_time, total_run_time, res.core_time / total_run_time))
490
491 if options.bell:
492 sys.stdout.write('\a')
493 sys.stdout.flush()
494
495 return num_failures
496
497
498def parse_args():

Callers 1

mainFunction · 0.70

Calls 8

runMethod · 0.95
ColorTextRunnerClass · 0.90
errlogFunction · 0.90
openFunction · 0.50
printFunction · 0.50
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected