Skip to content

[tests] Conditionally skip valgrind xfails using llvm::sys #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions unittests/CppInterOp/CUDATest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
18 changes: 12 additions & 6 deletions unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>)";
Interp->process(code);
Expand Down Expand Up @@ -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<Decl*> Decls, SubDecls;
std::string code = "int f1(int i) { return i * i; }";

Expand Down Expand Up @@ -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<Decl*> Decls;
std::string code = R"(
typedef struct _name {
Expand All @@ -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<Decl*> Decls;
std::string code = R"(
int f1(int i) { return i * i; }
Expand Down Expand Up @@ -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"(
Expand Down Expand Up @@ -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"(
Expand Down
9 changes: 6 additions & 3 deletions unittests/CppInterOp/InterpreterTest.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion unittests/CppInterOp/JitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Decl*> Decls;
std::string code = R"(
extern "C" int printf(const char*,...);
Expand Down
7 changes: 5 additions & 2 deletions unittests/CppInterOp/ScopeReflectionTest.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Utils.h"

#include "clang/Interpreter/CppInterOp.h"

#include "clang/AST/ASTContext.h"
Expand Down Expand Up @@ -799,7 +800,8 @@ template<typename T> 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 <memory>)";
Interp->process(code);
Expand Down Expand Up @@ -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 <vector>
#include <iostream>
Expand Down
3 changes: 2 additions & 1 deletion unittests/CppInterOp/TypeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"(
Expand Down
1 change: 1 addition & 0 deletions unittests/CppInterOp/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <memory>
#include <vector>
#include "llvm/Support/Valgrind.h"

using namespace clang;
using namespace llvm;
Expand Down
Loading