def test_make_benchmark_single_clang_invocation_multiple_inputs():
    with tempfile.TemporaryDirectory() as d:
        source_1 = Path(d) / "a.c"
        source_2 = Path(d) / "b.c"
        with open(str(source_1), "w") as f:
            f.write("int B() { return A(); }")
        with open(str(source_2), "w") as f:
            f.write("int A() { return 0; }")

        # cannot specify -o when generating multiple output files
        with pytest.raises(OSError):
            llvm.make_benchmark(llvm.ClangInvocation([str(source_1), str(source_2)]))
示例#2
0
def test_make_benchmark_invalid_clang_job():
    with pytest.raises(OSError) as ctx:
        llvm.make_benchmark(llvm.ClangInvocation(["-invalid-arg"]))

    assert "Compilation job failed with returncode" in str(ctx.value)
    assert "-invalid-arg" in str(ctx.value)
def test_make_benchmark_invalid_clang_job():
    with pytest.raises(OSError,
                       match="Compilation job failed with returncode"):
        llvm.make_benchmark(llvm.ClangInvocation(["-invalid-arg"]))