Skip to content

Commit ec97acb

Browse files
committed
Return true on CUDA tests if HasCudaSDK() is false
1 parent 68d00c1 commit ec97acb

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,6 @@ jobs:
827827
-DBUILD_SHARED_LIBS=ON \
828828
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
829829
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
830-
-DTEST_INTEROP_CUDA=0 \
831830
../
832831
fi
833832
os="${{ matrix.os }}"

unittests/CppInterOp/CMakeLists.txt

+2-17
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ set(LLVM_LINK_COMPONENTS
22
Support
33
)
44

5-
option(TEST_INTEROP_CUDA "Enables the CUDA Tests" ON)
6-
7-
if (TEST_INTEROP_CUDA)
8-
add_definitions(-DTEST_INTEROP_CUDA)
9-
add_cppinterop_unittest(CppInterOpCUDATests CUDATest.cpp)
10-
endif()
11-
125
add_cppinterop_unittest(CppInterOpTests
6+
CUDATest.cpp
137
EnumReflectionTest.cpp
148
FunctionReflectionTest.cpp
159
InterpreterTest.cpp
@@ -19,24 +13,15 @@ add_cppinterop_unittest(CppInterOpTests
1913
Utils.cpp
2014
VariableReflectionTest.cpp
2115
)
22-
2316
target_link_libraries(CppInterOpTests
2417
PRIVATE
2518
clangCppInterOp
2619
)
2720

28-
target_link_libraries(CppInterOpCUDATests
29-
PRIVATE
30-
clangCppInterOp
31-
)
32-
3321
set_source_files_properties(InterpreterTest.cpp PROPERTIES COMPILE_DEFINITIONS
3422
"LLVM_BINARY_DIR=\"${LLVM_BINARY_DIR}\""
3523
)
36-
37-
export_executable_symbols(CppInterOpTests
38-
CppInterOpCUDATests
39-
)
24+
export_executable_symbols(CppInterOpTests)
4025

4126
unset(LLVM_LINK_COMPONENTS)
4227

unittests/CppInterOp/CUDATest.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ TEST(DISABLED_CUDATest, Sanity) {
4646
#else
4747
TEST(CUDATest, Sanity) {
4848
#endif // CLANG_VERSION_MAJOR < 16
49+
if (!HasCudaSDK())
50+
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";
4951
EXPECT_TRUE(Cpp::CreateInterpreter({}, {"--cuda"}));
5052
}
5153

5254
TEST(CUDATest, CUDAH) {
5355
if (!HasCudaSDK())
54-
return;
56+
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";
5557

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

6163
TEST(CUDATest, CUDARuntime) {
6264
if (!HasCudaSDK())
63-
return;
65+
GTEST_SKIP() << "Skipping CUDA tests as CUDA SDK not found";
6466

6567
EXPECT_TRUE(HasCudaRuntime());
6668
}

0 commit comments

Comments
 (0)