Skip to content

Commit a410e75

Browse files
repair unit tests
1 parent 2a42cf8 commit a410e75

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

sycl/source/backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ make_kernel_bundle(pi_native_handle NativeHandle, const context &TargetContext,
199199
if (State == bundle_state::input)
200200
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
201201
"Program and kernel_bundle state mismatch " +
202-
PI_ERROR_INVALID_VALUE);
202+
detail::codeToString(PI_ERROR_INVALID_VALUE));
203203
if (State == bundle_state::executable)
204204
Plugin->call<errc::build, PiApiKind::piProgramLink>(
205205
ContextImpl->getHandleRef(), 1, &Dev, nullptr, 1, &PiProgram,

sycl/source/detail/allowlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
192192
// DPC++ RT to C++20
193193
if (Prefix != AllowListRaw.substr(ValueStart, Prefix.length())) {
194194
throw sycl::exception(
195-
sycl::errc::runtime,
195+
sycl::make_error_code(sycl::errc::runtime),
196196
"Key " + Key +
197197
" of SYCL_DEVICE_ALLOWLIST should have "
198198
"value which starts with " +

sycl/source/detail/scheduler/commands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,13 +2638,13 @@ pi_int32 ExecCGCommand::enqueueImp() {
26382638
case PI_ERROR_INVALID_OPERATION:
26392639
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
26402640
"Device doesn't support run_on_host_intel tasks. " +
2641-
Error);
2641+
detail::codeToString(Error));
26422642
case PI_SUCCESS:
26432643
return Error;
26442644
default:
26452645
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
26462646
"Enqueueing run_on_host_intel task has failed. " +
2647-
Error);
2647+
detail::codeToString(Error));
26482648
}
26492649
}
26502650
case CG::CGTYPE::Kernel: {

sycl/unittests/allowlist/ParseAllowList.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ TEST(ParseAllowListTests, CheckUnsupportedKeyNameIsHandledInSingleDeviceDesc) {
4848
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
4949
"BackendName:level_zero,SomeUnsupportedKey:gpu");
5050
throw std::logic_error("sycl::runtime_error didn't throw");
51-
} catch (sycl::runtime_error const &e) {
51+
} catch (sycl::exception const &e) {
5252
EXPECT_EQ(
5353
std::string("Unrecognized key in SYCL_DEVICE_ALLOWLIST. For "
5454
"details, please refer to "
5555
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
5656
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
5757
e.what());
5858
} catch (...) {
59-
FAIL() << "Expected sycl::runtime_error";
59+
FAIL() << "Expected sycl::exception";
6060
}
6161
}
6262

@@ -67,15 +67,15 @@ TEST(
6767
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
6868
"DriverVersion:{{value}}|SomeUnsupportedKey:gpu");
6969
throw std::logic_error("sycl::runtime_error didn't throw");
70-
} catch (sycl::runtime_error const &e) {
70+
} catch (sycl::exception const &e) {
7171
EXPECT_EQ(
7272
std::string("Unrecognized key in SYCL_DEVICE_ALLOWLIST. For "
7373
"details, please refer to "
7474
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
7575
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
7676
e.what());
7777
} catch (...) {
78-
FAIL() << "Expected sycl::runtime_error";
78+
FAIL() << "Expected sycl::exception";
7979
}
8080
}
8181

@@ -86,15 +86,15 @@ TEST(
8686
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
8787
"BackendName:level_zero|SomeUnsupportedKey:gpu");
8888
throw std::logic_error("sycl::runtime_error didn't throw");
89-
} catch (sycl::runtime_error const &e) {
89+
} catch (sycl::exception const &e) {
9090
EXPECT_EQ(
9191
std::string("Unrecognized key in SYCL_DEVICE_ALLOWLIST. For "
9292
"details, please refer to "
9393
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
9494
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
9595
e.what());
9696
} catch (...) {
97-
FAIL() << "Expected sycl::runtime_error";
97+
FAIL() << "Expected sycl::exception";
9898
}
9999
}
100100

@@ -104,15 +104,15 @@ TEST(ParseAllowListTests,
104104
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
105105
"DriverVersion:{{value1}}|SomeUnsupportedKey:{{value2}}");
106106
throw std::logic_error("sycl::runtime_error didn't throw");
107-
} catch (sycl::runtime_error const &e) {
107+
} catch (sycl::exception const &e) {
108108
EXPECT_EQ(
109109
std::string("Unrecognized key in SYCL_DEVICE_ALLOWLIST. For "
110110
"details, please refer to "
111111
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
112112
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
113113
e.what());
114114
} catch (...) {
115-
FAIL() << "Expected sycl::runtime_error";
115+
FAIL() << "Expected sycl::exception";
116116
}
117117
}
118118

@@ -131,14 +131,14 @@ TEST(ParseAllowListTests, CheckMissingOpenDoubleCurlyBracesAreHandled) {
131131
try {
132132
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
133133
"DeviceName:regex1}},DriverVersion:{{regex1|regex2}}");
134-
throw std::logic_error("sycl::runtime_error didn't throw");
135-
} catch (sycl::runtime_error const &e) {
134+
throw std::logic_error("sycl::exception didn't throw");
135+
} catch (sycl::exception const &e) {
136136
EXPECT_EQ(std::string("Key DeviceName of SYCL_DEVICE_ALLOWLIST "
137137
"should have value which starts with {{ -30 "
138138
"(PI_ERROR_INVALID_VALUE)"),
139139
e.what());
140140
} catch (...) {
141-
FAIL() << "Expected sycl::runtime_error";
141+
FAIL() << "Expected sycl::exception";
142142
}
143143
}
144144

@@ -147,13 +147,13 @@ TEST(ParseAllowListTests, CheckMissingClosedDoubleCurlyBracesAreHandled) {
147147
sycl::detail::AllowListParsedT ActualValue = sycl::detail::parseAllowList(
148148
"DeviceName:{{regex1}},DriverVersion:{{regex1|regex2");
149149
throw std::logic_error("sycl::runtime_error didn't throw");
150-
} catch (sycl::runtime_error const &e) {
150+
} catch (sycl::exception const &e) {
151151
EXPECT_EQ(std::string("Key DriverVersion of SYCL_DEVICE_ALLOWLIST "
152152
"should have value which ends with }} -30 "
153153
"(PI_ERROR_INVALID_VALUE)"),
154154
e.what());
155155
} catch (...) {
156-
FAIL() << "Expected sycl::runtime_error";
156+
FAIL() << "Expected sycl::exception";
157157
}
158158
}
159159

@@ -195,15 +195,15 @@ TEST(ParseAllowListTests, CheckIncorrectBackendNameValueIsHandled) {
195195
sycl::detail::AllowListParsedT ActualValue =
196196
sycl::detail::parseAllowList("BackendName:blablabla");
197197
throw std::logic_error("sycl::runtime_error didn't throw");
198-
} catch (sycl::runtime_error const &e) {
198+
} catch (sycl::exception const &e) {
199199
EXPECT_EQ(
200200
std::string("Value blablabla for key BackendName is not valid in "
201201
"SYCL_DEVICE_ALLOWLIST. For details, please refer to "
202202
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
203203
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
204204
e.what());
205205
} catch (...) {
206-
FAIL() << "Expected sycl::runtime_error";
206+
FAIL() << "Expected sycl::exception";
207207
}
208208
}
209209

@@ -212,15 +212,15 @@ TEST(ParseAllowListTests, CheckIncorrectDeviceTypeValueIsHandled) {
212212
sycl::detail::AllowListParsedT ActualValue =
213213
sycl::detail::parseAllowList("DeviceType:blablabla");
214214
throw std::logic_error("sycl::runtime_error didn't throw");
215-
} catch (sycl::runtime_error const &e) {
215+
} catch (sycl::exception const &e) {
216216
EXPECT_EQ(
217217
std::string("Value blablabla for key DeviceType is not valid in "
218218
"SYCL_DEVICE_ALLOWLIST. For details, please refer to "
219219
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
220220
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
221221
e.what());
222222
} catch (...) {
223-
FAIL() << "Expected sycl::runtime_error";
223+
FAIL() << "Expected sycl::exception";
224224
}
225225
}
226226

@@ -229,7 +229,7 @@ TEST(ParseAllowListTests, CheckIncorrectDeviceVendorIdValueIsHandled) {
229229
sycl::detail::AllowListParsedT ActualValue =
230230
sycl::detail::parseAllowList("DeviceVendorId:blablabla");
231231
throw std::logic_error("sycl::runtime_error didn't throw");
232-
} catch (sycl::runtime_error const &e) {
232+
} catch (sycl::exception const &e) {
233233
EXPECT_EQ(
234234
std::string("Value blablabla for key DeviceVendorId is not valid in "
235235
"SYCL_DEVICE_ALLOWLIST. It should have the hex format. For "
@@ -238,7 +238,7 @@ TEST(ParseAllowListTests, CheckIncorrectDeviceVendorIdValueIsHandled) {
238238
"EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
239239
e.what());
240240
} catch (...) {
241-
FAIL() << "Expected sycl::runtime_error";
241+
FAIL() << "Expected sycl::exception";
242242
}
243243
}
244244

@@ -261,15 +261,15 @@ TEST(ParseAllowListTests, CheckExceptionIsThrownForValueWOColonDelim) {
261261
sycl::detail::AllowListParsedT ActualValue =
262262
sycl::detail::parseAllowList("SomeValueWOColonDelimiter");
263263
throw std::logic_error("sycl::runtime_error didn't throw");
264-
} catch (sycl::runtime_error const &e) {
264+
} catch (sycl::exception const &e) {
265265
EXPECT_EQ(
266266
std::string("SYCL_DEVICE_ALLOWLIST has incorrect format. For "
267267
"details, please refer to "
268268
"https://github.com/intel/llvm/blob/sycl/sycl/"
269269
"doc/EnvironmentVariables.md -30 (PI_ERROR_INVALID_VALUE)"),
270270
e.what());
271271
} catch (...) {
272-
FAIL() << "Expected sycl::runtime_error";
272+
FAIL() << "Expected sycl::exception";
273273
}
274274
}
275275

0 commit comments

Comments
 (0)