Skip to content

Commit 4877223

Browse files
committed
Conditionally skip valgrind xfails using llvm::sys
1 parent d14136e commit 4877223

File tree

6 files changed

+28
-13
lines changed

6 files changed

+28
-13
lines changed

unittests/CppInterOp/CUDATest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ TEST(CUDATest, CUDAH) {
6161
}
6262

6363
TEST(CUDATest, CUDARuntime) {
64-
if (!HasCudaSDK())
65-
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";
64+
if (!HasCudaRuntime())
65+
GTEST_SKIP() << "Skipping CUDA tests as CUDA runtime not found";
6666

6767
EXPECT_TRUE(HasCudaRuntime());
6868
}

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Utils.h"
22

3+
#include "llvm/Support/Valgrind.h"
34
#include "clang/AST/ASTContext.h"
45
#include "clang/Interpreter/CppInterOp.h"
56
#include "clang/Frontend/CompilerInstance.h"
@@ -531,7 +532,8 @@ TEST(FunctionReflectionTest, ExistsFunctionTemplate) {
531532
}
532533

533534
TEST(FunctionReflectionTest, InstantiateTemplateFunctionFromString) {
534-
GTEST_SKIP() << "XFAIL due to Valgrind report";
535+
if (llvm::sys::RunningOnValgrind())
536+
GTEST_SKIP() << "XFAIL due to Valgrind report";
535537
Cpp::CreateInterpreter();
536538
std::string code = R"(#include <memory>)";
537539
Interp->process(code);
@@ -733,7 +735,8 @@ TEST(FunctionReflectionTest, IsStaticMethod) {
733735
}
734736

735737
TEST(FunctionReflectionTest, GetFunctionAddress) {
736-
GTEST_SKIP() << "XFAIL due to Valgrind report";
738+
if (llvm::sys::RunningOnValgrind())
739+
GTEST_SKIP() << "XFAIL due to Valgrind report";
737740
std::vector<Decl*> Decls, SubDecls;
738741
std::string code = "int f1(int i) { return i * i; }";
739742

@@ -773,7 +776,8 @@ TEST(FunctionReflectionTest, IsVirtualMethod) {
773776
}
774777

775778
TEST(FunctionReflectionTest, JitCallAdvanced) {
776-
GTEST_SKIP() << "XFAIL due to Valgrind report";
779+
if (llvm::sys::RunningOnValgrind())
780+
GTEST_SKIP() << "XFAIL due to Valgrind report";
777781
std::vector<Decl*> Decls;
778782
std::string code = R"(
779783
typedef struct _name {
@@ -796,7 +800,8 @@ TEST(FunctionReflectionTest, JitCallAdvanced) {
796800

797801

798802
TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
799-
GTEST_SKIP() << "XFAIL due to Valgrind report";
803+
if (llvm::sys::RunningOnValgrind())
804+
GTEST_SKIP() << "XFAIL due to Valgrind report";
800805
std::vector<Decl*> Decls;
801806
std::string code = R"(
802807
int f1(int i) { return i * i; }
@@ -1006,7 +1011,8 @@ TEST(FunctionReflectionTest, GetFunctionArgDefault) {
10061011
}
10071012

10081013
TEST(FunctionReflectionTest, Construct) {
1009-
GTEST_SKIP() << "XFAIL due to Valgrind report";
1014+
if (llvm::sys::RunningOnValgrind())
1015+
GTEST_SKIP() << "XFAIL due to Valgrind report";
10101016
Cpp::CreateInterpreter();
10111017

10121018
Interp->declare(R"(
@@ -1041,7 +1047,8 @@ TEST(FunctionReflectionTest, Construct) {
10411047
}
10421048

10431049
TEST(FunctionReflectionTest, Destruct) {
1044-
GTEST_SKIP() << "XFAIL due to Valgrind report";
1050+
if (llvm::sys::RunningOnValgrind())
1051+
GTEST_SKIP() << "XFAIL due to Valgrind report";
10451052
Cpp::CreateInterpreter();
10461053

10471054
Interp->declare(R"(

unittests/CppInterOp/InterpreterTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ TEST(InterpreterTest, DebugFlag) {
4444
}
4545

4646
TEST(InterpreterTest, Evaluate) {
47-
GTEST_SKIP() << "XFAIL due to Valgrind report";
47+
if (llvm::sys::RunningOnValgrind())
48+
GTEST_SKIP() << "XFAIL due to Valgrind report";
4849
// EXPECT_TRUE(Cpp::Evaluate(I, "") == 0);
4950
//EXPECT_TRUE(Cpp::Evaluate(I, "__cplusplus;") == 201402);
5051
// Due to a deficiency in the clang-repl implementation to get the value we
@@ -59,7 +60,8 @@ TEST(InterpreterTest, Evaluate) {
5960
}
6061

6162
TEST(InterpreterTest, Process) {
62-
GTEST_SKIP() << "XFAIL due to Valgrind report";
63+
if (llvm::sys::RunningOnValgrind())
64+
GTEST_SKIP() << "XFAIL due to Valgrind report";
6365
Cpp::CreateInterpreter();
6466
EXPECT_TRUE(Cpp::Process("") == 0);
6567
EXPECT_TRUE(Cpp::Process("int a = 12;") == 0);

unittests/CppInterOp/JitTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Utils.h"
22

33
#include "clang/Interpreter/CppInterOp.h"
4+
#include "llvm/Support/Valgrind.h"
45

56
#include "gtest/gtest.h"
67

@@ -12,7 +13,8 @@ static int printf_jit(const char* format, ...) {
1213
}
1314

1415
TEST(JitTest, InsertOrReplaceJitSymbol) {
15-
GTEST_SKIP() << "XFAIL due to Valgrind report";
16+
if (llvm::sys::RunningOnValgrind())
17+
GTEST_SKIP() << "XFAIL due to Valgrind report";
1618
std::vector<Decl*> Decls;
1719
std::string code = R"(
1820
extern "C" int printf(const char*,...);

unittests/CppInterOp/ScopeReflectionTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "Utils.h"
2+
#include "llvm/Support/Valgrind.h"
23
#include "clang/Interpreter/CppInterOp.h"
34

45
#include "clang/AST/ASTContext.h"
@@ -799,7 +800,8 @@ template<typename T> T TrivialFnTemplate() { return T(); }
799800
}
800801

801802
TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) {
802-
GTEST_SKIP() << "XFAIL due to Valgrind report";
803+
if (llvm::sys::RunningOnValgrind())
804+
GTEST_SKIP() << "XFAIL due to Valgrind report";
803805
Cpp::CreateInterpreter();
804806
std::string code = R"(#include <memory>)";
805807
Interp->process(code);

unittests/CppInterOp/TypeReflectionTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Utils.h"
22

3+
#include "llvm/Support/Valgrind.h"
34
#include "clang/AST/ASTContext.h"
45
#include "clang/Interpreter/CppInterOp.h"
56
#include "clang/Frontend/CompilerInstance.h"
@@ -523,7 +524,8 @@ TEST(TypeReflectionTest, IsPODType) {
523524
}
524525

525526
TEST(TypeReflectionTest, IsSmartPtrType) {
526-
GTEST_SKIP() << "XFAIL due to Valgrind report";
527+
if (llvm::sys::RunningOnValgrind())
528+
GTEST_SKIP() << "XFAIL due to Valgrind report";
527529
Cpp::CreateInterpreter();
528530

529531
Interp->declare(R"(

0 commit comments

Comments
 (0)