Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit ac68994

Browse files
[SYCL] Change tests for PI errors (#1061)
intel/llvm#6328 changes error reporting to use PI error enumerator names rather than OpenCL ones. Some of the test-suite tests rely on the OpenCL names being reported however, so this commit changes these tests to use the PI equivalents instead. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 6646adc commit ac68994

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

SYCL/FilterSelector/select.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,14 @@ int main() {
120120
device d8(filter_selector("0"));
121121
std::cout << "...PASS" << std::endl;
122122

123-
std::string ErrorMesg(
124-
"Could not find a device that matches the specified filter(s)!");
125-
126123
try {
127124
// pick something crazy
128125
device d9(filter_selector("gpu:999"));
129126
std::cout << "d9 = " << d9.get_info<info::device::name>() << std::endl;
130127
} catch (const sycl::runtime_error &e) {
131-
assert(ErrorMesg.find_first_of(e.what()) == 0);
128+
const char *ErrorMesg =
129+
"Could not find a device that matches the specified filter(s)!";
130+
assert(std::string{e.what()}.find(ErrorMesg) == 0);
132131
std::cout << "Selector failed as expected! OK" << std::endl;
133132
}
134133

@@ -137,7 +136,8 @@ int main() {
137136
device d10(filter_selector("bob:gpu"));
138137
std::cout << "d10 = " << d10.get_info<info::device::name>() << std::endl;
139138
} catch (const sycl::runtime_error &e) {
140-
assert(ErrorMesg.find_first_of(e.what()) == 0);
139+
const char *ErrorMesg = "Invalid filter string!";
140+
assert(std::string{e.what()}.find(ErrorMesg) == 0);
141141
std::cout << "Selector failed as expected! OK" << std::endl;
142142
}
143143

@@ -146,7 +146,8 @@ int main() {
146146
device d11(filter_selector("opencl:bob"));
147147
std::cout << "d11 = " << d11.get_info<info::device::name>() << std::endl;
148148
} catch (const sycl::runtime_error &e) {
149-
assert(ErrorMesg.find_first_of(e.what()) == 0);
149+
const char *ErrorMesg = "Invalid filter string!";
150+
assert(std::string{e.what()}.find(ErrorMesg) == 0);
150151
std::cout << "Selector failed as expected! OK" << std::endl;
151152
}
152153

SYCL/KernelAndProgram/build-log.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void test() {
2121
cl::sycl::queue Queue;
2222

2323
// Submitting this kernel should result in a compile_program_error exception
24-
// with a message indicating "CL_BUILD_PROGRAM_FAILURE".
24+
// with a message indicating "PI_ERROR_BUILD_PROGRAM_FAILURE".
2525
auto Kernel = []() {
2626
#ifdef __SYCL_DEVICE_ONLY__
2727
#ifdef GPU
@@ -43,7 +43,7 @@ void test() {
4343
} catch (const cl::sycl::compile_program_error &e) {
4444
std::string Msg(e.what());
4545
std::cerr << Msg << std::endl;
46-
assert(Msg.find("CL_BUILD_PROGRAM_FAILURE") != std::string::npos);
46+
assert(Msg.find("PI_ERROR_BUILD_PROGRAM_FAILURE") != std::string::npos);
4747
} catch (...) {
4848
assert(false && "There must be cl::sycl::compile_program_error");
4949
}

SYCL/KernelAndProgram/cache-build-result.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ void test() {
3838
Result = e.get_cl_code();
3939
} else {
4040
// Exception constantly adds info on its error code in the message
41-
assert(Msg.find_first_of(e.what()) == 0 && "CL_BUILD_PROGRAM_FAILURE");
41+
assert(Msg.find_first_of(e.what()) == 0 &&
42+
"PI_ERROR_BUILD_PROGRAM_FAILURE");
4243
assert(Result == e.get_cl_code() && "Exception code differs");
4344
}
4445
} catch (...) {

0 commit comments

Comments
 (0)