def run_test_uninit(compiler: Optional[Compiler], reporter: Reporter, tests: List[str], config: Config, timeout: Optional[float] = None) -> bool: reporter.log('Running tests with uninitialized variable check', 'title') runner = Runner() compiler = find_clang_compiler() if compiler is None else compiler if compiler is None: sys.exit("I'm sorry, I could not find a suitable clang compiler.") if isinstance(compiler, ClangCompiler) and compiler.version[0] < 8: sys.exit(f"I'm sorry, but the clang compiler {compiler} is too old.") compiler = config.common_flags(compiler).add_flag('-O3').add_flag( '-g').add_flag('-ftrivial-auto-var-init=pattern') orig_tests = tests tests = expand_glob(tests, ['tests/*', 'benchmarks/*']) if not tests: no_tests_error(orig_tests, ['tests', 'benchmarks']) return run_test(compiler=compiler, runner=runner, reporter=reporter, name='test-uninit', tests=tests, config=config, timeout=timeout)
def run_test_plain(compiler: Optional[Compiler], reporter: Reporter, tests: List[str], config: Config, timeout: Optional[float] = None) -> bool: reporter.log('Running tests', 'title') runner = Runner() compiler = config.find_compiler() if compiler is None else compiler if compiler is None: sys.exit("I'm sorry, I could not find a suitable compiler.") compiler = config.common_flags(compiler).add_flag('-O3').add_flag('-g') orig_tests = tests tests = expand_glob(tests, ['tests/*', 'benchmarks/*']) if not tests: no_tests_error(orig_tests, ['tests', 'benchmarks']) return run_test(compiler=compiler, runner=runner, reporter=reporter, name='test-plain', tests=tests, config=config, timeout=timeout)
def run_benchmark(compiler: Compiler, runner: Runner, reporter: Reporter, name: str, tests: List[str], config: Config, timeout: Optional[float] = None) -> bool: rep = reporter.benchmark_group(name, tests) output = rep.compilation( compiler.add_source(config.tester).add_source( config.source)).compile(out_file=config.binary) if not output.is_success(): return False for test in tests: runner_output = runner.run(config, config.benchmark_command(test), timeout=parse_timeout(test, timeout)) rep.benchmark(test, runner_output) if runner_output.errors or not runner_output.run_successful: return False return True
def run_benchmark_all(compiler: Optional[Compiler], reporter: Reporter, tests: List[str], config: Config, timeout: Optional[float] = None) -> bool: reporter.log('Running benchmark', 'title') runner = Runner() compiler = config.find_compiler() if compiler is None else compiler if compiler is None: raise RuntimeError("Could not find a suitable compiler") compiler = config.common_flags(compiler).add_flag('-O3').add_flag('-g') orig_tests = tests tests = expand_glob(tests, ['benchmarks/*']) if not tests: no_tests_error(orig_tests, ['benchmarks']) return run_benchmark(compiler=compiler, runner=runner, reporter=reporter, name='benchmark-all', tests=tests, config=config, timeout=timeout)