Skip to content

Commit

Permalink
Return true on CUDA tests if HasCudaSDK() is false
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronj0 committed May 6, 2024
1 parent 68d00c1 commit ec97acb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ jobs:
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
-DTEST_INTEROP_CUDA=0 \
../
fi
os="${{ matrix.os }}"
Expand Down
19 changes: 2 additions & 17 deletions unittests/CppInterOp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ set(LLVM_LINK_COMPONENTS
Support
)

option(TEST_INTEROP_CUDA "Enables the CUDA Tests" ON)

if (TEST_INTEROP_CUDA)
add_definitions(-DTEST_INTEROP_CUDA)
add_cppinterop_unittest(CppInterOpCUDATests CUDATest.cpp)
endif()

add_cppinterop_unittest(CppInterOpTests
CUDATest.cpp
EnumReflectionTest.cpp
FunctionReflectionTest.cpp
InterpreterTest.cpp
Expand All @@ -19,24 +13,15 @@ add_cppinterop_unittest(CppInterOpTests
Utils.cpp
VariableReflectionTest.cpp
)

target_link_libraries(CppInterOpTests
PRIVATE
clangCppInterOp
)

target_link_libraries(CppInterOpCUDATests
PRIVATE
clangCppInterOp
)

set_source_files_properties(InterpreterTest.cpp PROPERTIES COMPILE_DEFINITIONS
"LLVM_BINARY_DIR=\"${LLVM_BINARY_DIR}\""
)

export_executable_symbols(CppInterOpTests
CppInterOpCUDATests
)
export_executable_symbols(CppInterOpTests)

unset(LLVM_LINK_COMPONENTS)

Expand Down
6 changes: 4 additions & 2 deletions unittests/CppInterOp/CUDATest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ TEST(DISABLED_CUDATest, Sanity) {
#else
TEST(CUDATest, Sanity) {
#endif // CLANG_VERSION_MAJOR < 16
if (!HasCudaSDK())
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";
EXPECT_TRUE(Cpp::CreateInterpreter({}, {"--cuda"}));
}

TEST(CUDATest, CUDAH) {
if (!HasCudaSDK())
return;
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";

Cpp::CreateInterpreter({}, {"--cuda"});
bool success = !Cpp::Declare("#include <cuda.h>");
Expand All @@ -60,7 +62,7 @@ TEST(CUDATest, CUDAH) {

TEST(CUDATest, CUDARuntime) {
if (!HasCudaSDK())
return;
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";

EXPECT_TRUE(HasCudaRuntime());
}

0 comments on commit ec97acb

Please sign in to comment.