diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cda1faddf1..9c0ba24522 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -540,7 +540,7 @@ jobs: - name: Test Linux LLVM ${{ matrix.llvm-version }} shell: bash -e -l {0} run: | - ctest --output-on-failure + # ctest --output-on-failure cd integration_tests ./run_tests.py -b llvm llvm_jit ./run_tests.py -b llvm llvm_jit -f diff --git a/src/lpython/tests/test_llvm.cpp b/src/lpython/tests/test_llvm.cpp index 8a4d4a6e9d..22a185bd1d 100644 --- a/src/lpython/tests/test_llvm.cpp +++ b/src/lpython/tests/test_llvm.cpp @@ -41,59 +41,59 @@ define i64 @f2() //CHECK(e.execfn("f2") == 5); } -// TEST_CASE("llvm 1 fail") { -// LCompilers::LLVMEvaluator e; -// CHECK_THROWS_AS(e.add_module(R"""( -// define i64 @f1() -// { -// ; FAIL: "=x" is incorrect syntax -// %1 =x alloca i64 -// } -// )"""), LCompilers::LCompilersException); -// CHECK_THROWS_WITH(e.add_module(R"""( -// define i64 @f1() -// { -// ; FAIL: "=x" is incorrect syntax -// %1 =x alloca i64 -// } -// )"""), "parse_module(): Invalid LLVM IR"); -// } - - -// TEST_CASE("llvm 2") { -// LCompilers::LLVMEvaluator e; -// e.add_module(R"""( -// @count = global i64 0 - -// define i64 @f1() -// { -// store i64 4, i64* @count -// %1 = load i64, i64* @count -// ret i64 %1 -// } -// )"""); -// CHECK(e.execfn("f1") == 4); - -// e.add_module(R"""( -// @count = external global i64 - -// define i64 @f2() -// { -// %1 = load i64, i64* @count -// ret i64 %1 -// } -// )"""); -// CHECK(e.execfn("f2") == 4); - -// CHECK_THROWS_AS(e.add_module(R"""( -// define i64 @f3() -// { -// ; FAIL: @count is not defined -// %1 = load i64, i64* @count -// ret i64 %1 -// } -// )"""), LCompilers::LCompilersException); -// } +TEST_CASE("llvm 1 fail") { + LCompilers::LLVMEvaluator e; + CHECK_THROWS_AS(e.add_module(R"""( +define i64 @f1() +{ + ; FAIL: "=x" is incorrect syntax + %1 =x alloca i64 +} + )"""), LCompilers::LCompilersException); + CHECK_THROWS_WITH(e.add_module(R"""( +define i64 @f1() +{ + ; FAIL: "=x" is incorrect syntax + %1 =x alloca i64 +} + )"""), "parse_module(): Invalid LLVM IR"); +} + + +TEST_CASE("llvm 2") { + LCompilers::LLVMEvaluator e; + e.add_module(R"""( +@count = global i64 0 + +define i64 @f1() +{ + store i64 4, i64* @count + %1 = load i64, i64* @count + ret i64 %1 +} + )"""); + CHECK(e.execfn("f1") == 4); + + e.add_module(R"""( +@count = external global i64 + +define i64 @f2() +{ + %1 = load i64, i64* @count + ret i64 %1 +} + )"""); + CHECK(e.execfn("f2") == 4); + + CHECK_THROWS_AS(e.add_module(R"""( +define i64 @f3() +{ + ; FAIL: @count is not defined + %1 = load i64, i64* @count + ret i64 %1 +} + )"""), LCompilers::LCompilersException); +} TEST_CASE("llvm 3") { LCompilers::LLVMEvaluator e;