Skip to content

Commit d67c069

Browse files
committed
Improve testing
1 parent c97e365 commit d67c069

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

sycl/test/basic_tests/pluign_overrides.cpp renamed to sycl/test/basic_tests/pluign_overrides_negative.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clangxx -fsycl %s -o %t.out
22
// RUN: env SYCL_OVERRIDE_PI_OPENCL=opencl_test env SYCL_OVERRIDE_PI_LEVEL_ZERO=l0_test env SYCL_OVERRIDE_PI_CUDA=cuda_test env SYCL_OVERRIDE_PI_ROCM=rocm_test env SYCL_PI_TRACE=-1 %t.out > %t.log 2>&1
3-
// FileCheck %s --input-file %t.log
3+
// RUN: FileCheck %s --input-file %t.log
44

55
#include <sycl/sycl.hpp>
66

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// RUN: %clangxx -fsycl -DFAKE_PLUGIN -shared %s -o %t_fake_plugin.so
2+
// RUN: %clangxx -fsycl %s -o %t.out
3+
// RUN: env SYCL_OVERRIDE_PI_OPENCL=%t_fake_plugin.so env SYCL_OVERRIDE_PI_LEVEL_ZERO=%t_fake_plugin.so env SYCL_OVERRIDE_PI_CUDA=%t_fake_plugin.so env SYCL_OVERRIDE_PI_ROCM=%t_fake_plugin.so env SYCL_PI_TRACE=-1 %t.out > %t.log 2>&1
4+
// RUN: FileCheck %s --input-file %t.log
5+
// REQUIRES: linux
6+
7+
#ifdef FAKE_PLUGIN
8+
9+
#include <CL/sycl/detail/pi.h>
10+
11+
pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms,
12+
pi_uint32 *NumPlatforms) {
13+
return PI_INVALID_OPERATION;
14+
}
15+
16+
pi_result piTearDown(void *) { return PI_SUCCESS; }
17+
18+
pi_result piPluginInit(pi_plugin *PluginInit) {
19+
PluginInit->PiFunctionTable.piPlatformsGet = piPlatformsGet;
20+
PluginInit->PiFunctionTable.piTearDown = piTearDown;
21+
return PI_SUCCESS;
22+
}
23+
24+
#else
25+
26+
#include <sycl/sycl.hpp>
27+
28+
int main() {
29+
try {
30+
sycl::platform P{sycl::default_selector{}};
31+
} catch (...) {
32+
// NOP
33+
}
34+
35+
return 0;
36+
}
37+
38+
#endif
39+
40+
// CHECK: SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: {{[0-9a-zA-Z_\/\.]+}}_fake_plugin.so
41+
// CHECK: SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: {{[0-9a-zA-Z_\/\.]+}}_fake_plugin.so
42+
// CHECK: SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: {{[0-9a-zA-Z_\/\.]+}}_fake_plugin.so
43+
// CHECK: SYCL_PI_TRACE[basic]: Plugin found and successfully loaded: {{[0-9a-zA-Z_\/\.]+}}_fake_plugin.so

0 commit comments

Comments
 (0)