diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a36bbec9c..b62132e11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -294,6 +294,7 @@ jobs: run: | # Install deps sudo apt-get update + sudo apt-get install valgrind sudo apt-get autoremove sudo apt-get clean diff --git a/unittests/CppInterOp/CUDATest.cpp b/unittests/CppInterOp/CUDATest.cpp index 2f4faa1b6..17bf80dff 100644 --- a/unittests/CppInterOp/CUDATest.cpp +++ b/unittests/CppInterOp/CUDATest.cpp @@ -61,8 +61,8 @@ TEST(CUDATest, CUDAH) { } TEST(CUDATest, CUDARuntime) { - if (!HasCudaSDK()) - GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found"; + if (!HasCudaRuntime()) + GTEST_SKIP() << "Skipping CUDA tests as CUDA runtime not found"; EXPECT_TRUE(HasCudaRuntime()); } diff --git a/unittests/CppInterOp/FunctionReflectionTest.cpp b/unittests/CppInterOp/FunctionReflectionTest.cpp index 123760d53..afa5a584d 100644 --- a/unittests/CppInterOp/FunctionReflectionTest.cpp +++ b/unittests/CppInterOp/FunctionReflectionTest.cpp @@ -531,7 +531,8 @@ TEST(FunctionReflectionTest, ExistsFunctionTemplate) { } TEST(FunctionReflectionTest, InstantiateTemplateFunctionFromString) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); std::string code = R"(#include )"; Interp->process(code); @@ -733,7 +734,8 @@ TEST(FunctionReflectionTest, IsStaticMethod) { } TEST(FunctionReflectionTest, GetFunctionAddress) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; std::vector Decls, SubDecls; std::string code = "int f1(int i) { return i * i; }"; @@ -773,7 +775,8 @@ TEST(FunctionReflectionTest, IsVirtualMethod) { } TEST(FunctionReflectionTest, JitCallAdvanced) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; std::vector Decls; std::string code = R"( typedef struct _name { @@ -796,7 +799,8 @@ TEST(FunctionReflectionTest, JitCallAdvanced) { TEST(FunctionReflectionTest, GetFunctionCallWrapper) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; std::vector Decls; std::string code = R"( int f1(int i) { return i * i; } @@ -1006,7 +1010,8 @@ TEST(FunctionReflectionTest, GetFunctionArgDefault) { } TEST(FunctionReflectionTest, Construct) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); Interp->declare(R"( @@ -1041,7 +1046,8 @@ TEST(FunctionReflectionTest, Construct) { } TEST(FunctionReflectionTest, Destruct) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); Interp->declare(R"( diff --git a/unittests/CppInterOp/InterpreterTest.cpp b/unittests/CppInterOp/InterpreterTest.cpp index 1937f6857..01b3bb114 100644 --- a/unittests/CppInterOp/InterpreterTest.cpp +++ b/unittests/CppInterOp/InterpreterTest.cpp @@ -1,5 +1,6 @@ -#include "clang/Interpreter/CppInterOp.h" +#include "Utils.h" +#include "clang/Interpreter/CppInterOp.h" #include "clang/Basic/Version.h" #include "llvm/ADT/SmallString.h" @@ -44,7 +45,8 @@ TEST(InterpreterTest, DebugFlag) { } TEST(InterpreterTest, Evaluate) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; // EXPECT_TRUE(Cpp::Evaluate(I, "") == 0); //EXPECT_TRUE(Cpp::Evaluate(I, "__cplusplus;") == 201402); // Due to a deficiency in the clang-repl implementation to get the value we @@ -59,7 +61,8 @@ TEST(InterpreterTest, Evaluate) { } TEST(InterpreterTest, Process) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); EXPECT_TRUE(Cpp::Process("") == 0); EXPECT_TRUE(Cpp::Process("int a = 12;") == 0); diff --git a/unittests/CppInterOp/JitTest.cpp b/unittests/CppInterOp/JitTest.cpp index dacb2345b..5d0e55d58 100644 --- a/unittests/CppInterOp/JitTest.cpp +++ b/unittests/CppInterOp/JitTest.cpp @@ -12,7 +12,8 @@ static int printf_jit(const char* format, ...) { } TEST(JitTest, InsertOrReplaceJitSymbol) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; std::vector Decls; std::string code = R"( extern "C" int printf(const char*,...); diff --git a/unittests/CppInterOp/ScopeReflectionTest.cpp b/unittests/CppInterOp/ScopeReflectionTest.cpp index f6dc8234a..2cbeb5823 100644 --- a/unittests/CppInterOp/ScopeReflectionTest.cpp +++ b/unittests/CppInterOp/ScopeReflectionTest.cpp @@ -1,4 +1,5 @@ #include "Utils.h" + #include "clang/Interpreter/CppInterOp.h" #include "clang/AST/ASTContext.h" @@ -799,7 +800,8 @@ template T TrivialFnTemplate() { return T(); } } TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); std::string code = R"(#include )"; Interp->process(code); @@ -938,7 +940,8 @@ TEST(ScopeReflectionTest, GetClassTemplateInstantiationArgs) { TEST(ScopeReflectionTest, IncludeVector) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; std::string code = R"( #include #include diff --git a/unittests/CppInterOp/TypeReflectionTest.cpp b/unittests/CppInterOp/TypeReflectionTest.cpp index 3ac31d4d4..0d286e18f 100644 --- a/unittests/CppInterOp/TypeReflectionTest.cpp +++ b/unittests/CppInterOp/TypeReflectionTest.cpp @@ -523,7 +523,8 @@ TEST(TypeReflectionTest, IsPODType) { } TEST(TypeReflectionTest, IsSmartPtrType) { - GTEST_SKIP() << "XFAIL due to Valgrind report"; + if (llvm::sys::RunningOnValgrind()) + GTEST_SKIP() << "XFAIL due to Valgrind report"; Cpp::CreateInterpreter(); Interp->declare(R"( diff --git a/unittests/CppInterOp/Utils.h b/unittests/CppInterOp/Utils.h index d558798b2..8eff16abf 100644 --- a/unittests/CppInterOp/Utils.h +++ b/unittests/CppInterOp/Utils.h @@ -5,6 +5,7 @@ #include #include +#include "llvm/Support/Valgrind.h" using namespace clang; using namespace llvm;