예제 #1
0
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)
예제 #2
0
def clang_compiler(name):
    if name == '':
        compiler = find_clang_compiler()
    else:
        compiler = ClangCompiler(name)
    if compiler is None:
        raise argparse.ArgumentTypeError(
            f"Couldn't automatically find clang compiler")
    elif not compiler.is_valid():
        raise argparse.ArgumentTypeError(
            f"Program {compiler} is not a supported clang compiler")
    return compiler
예제 #3
0
 def find_compiler(self) -> Optional[Compiler]:
     return find_gcc_compiler() or find_clang_compiler()
예제 #4
0
 def find_compiler(self) -> Optional[Compiler]:
     if self.gpu:
         return find_nvcc_compiler()
     else:
         return find_gcc_compiler() or find_clang_compiler()