File tree Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,37 @@ TEST(CUDATest, CUDARuntime) {
75
75
76
76
EXPECT_TRUE (HasCudaRuntime ());
77
77
}
78
+
79
+ #ifndef CPPINTEROP_USE_CLING
80
+ static bool HasCudaSDK_CAPI () {
81
+ auto supportsCudaSDK = []() {
82
+ #if CLANG_VERSION_MAJOR < 16
83
+ return false ;
84
+ #endif // CLANG_VERSION_MAJOR < 16
85
+
86
+ const char * argv[] = {" --cuda" };
87
+ CXInterpreter CXI = clang_createInterpreter (argv, 1 );
88
+ if (!CXI)
89
+ return false ;
90
+
91
+ // Clean up the interpreter since we just needed to test creation
92
+ clang_Interpreter_dispose (CXI);
93
+ return true ;
94
+ };
95
+ static bool hasCuda = supportsCudaSDK ();
96
+ return hasCuda;
97
+ }
98
+
99
+ TEST (CUDATest, SanityCAPI) {
100
+ #ifdef _WIN32
101
+ GTEST_SKIP () << " Disabled on Windows. Needs fixing." ;
102
+ #endif
103
+ if (!HasCudaSDK_CAPI ())
104
+ GTEST_SKIP () << " Skipping CUDA CAPI test; CUDA not available." ;
105
+
106
+ const char * argv[] = {" --cuda" };
107
+ CXInterpreter CXI = clang_createInterpreter (argv, 1 );
108
+ EXPECT_NE (CXI, nullptr );
109
+ clang_Interpreter_dispose (CXI);
110
+ }
111
+ #endif
Original file line number Diff line number Diff line change @@ -177,14 +177,6 @@ TEST(InterpreterTest, CreateInterpreterCAPI) {
177
177
178
178
clang_Interpreter_dispose (CXI);
179
179
}
180
-
181
- TEST (InterpreterTest, CreateInterpreterCAPIFailure) {
182
- const char * argv[] = {
183
- " --this-flag-should-not-exist"
184
- };
185
- CXInterpreter CXI = clang_createInterpreter (argv, 1 );
186
- EXPECT_EQ (CXI, nullptr );
187
- }
188
180
#endif
189
181
190
182
#ifdef LLVM_BINARY_DIR
You can’t perform that action at this time.
0 commit comments