Skip to content

Commit b6a8e76

Browse files
authored
[SYCL][E2E] Use sycl 2020 exceptions in KernelAndProgram e2e tests (#14229)
1 parent dbfa7b9 commit b6a8e76

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sycl/test-e2e/KernelAndProgram/build-log.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ void test() {
4040
Queue.submit(
4141
[&](sycl::handler &CGH) { CGH.single_task<class SingleTask>(Kernel); });
4242
assert(false && "There must be compilation error");
43-
} catch (const sycl::compile_program_error &e) {
43+
} catch (const sycl::exception &e) {
4444
std::string Msg(e.what());
4545
std::cerr << Msg << std::endl;
46+
assert(e.code() == sycl::errc::build &&
47+
"Caught exception was not a compilation error");
4648
assert(Msg.find("PI_ERROR_BUILD_PROGRAM_FAILURE") != std::string::npos);
4749
} catch (...) {
48-
assert(false && "There must be sycl::compile_program_error");
50+
assert(false && "Caught exception was not a compilation error");
4951
}
5052
}
5153

sycl/test-e2e/KernelAndProgram/cache-build-result.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ void test() {
3232
CGH.single_task<class SingleTask>(Kernel);
3333
});
3434
assert(false && "There must be compilation error");
35-
} catch (const sycl::compile_program_error &e) {
35+
} catch (const sycl::exception &e) {
3636
fprintf(stderr, "Exception: %s, %d\n", e.what(), e.code().value());
37+
assert(e.code() == sycl::errc::build &&
38+
"Caught exception was not a compilation error");
3739
if (Idx == 0) {
3840
Msg = e.what();
39-
Result = e.code().value();
4041
} else {
4142
// Exception constantly adds info on its error code in the message
4243
assert(Msg.find_first_of(e.what()) == 0 &&
4344
"PI_ERROR_BUILD_PROGRAM_FAILURE");
44-
assert(Result == e.code().value() && "Exception code differs");
4545
}
4646
} catch (...) {
47-
assert(false && "There must be sycl::compile_program_error");
47+
assert(false && "Caught exception was not a compilation error");
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)