Skip to content

Commit 83d0527

Browse files
committed
fix
1 parent 7ebc9d2 commit 83d0527

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

sycl/test-e2e/Basic/info.cpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ int main() {
208208
std::string separator(std::string(80, '-') + "\n");
209209
std::cout << separator << "Device information\n" << separator;
210210
device dev(default_selector_v);
211+
backend backnd{dev.get_backend()};
211212

212213
print_info<info::device::device_type, info::device_type>(dev, "Device type");
213214
print_info<info::device::vendor_id, std::uint32_t>(dev, "Vendor ID");
@@ -322,11 +323,17 @@ int main() {
322323
print_info<info::device::name, std::string>(dev, "Name");
323324
print_info<info::device::vendor, std::string>(dev, "Vendor");
324325
print_info<info::device::driver_version, std::string>(dev, "Driver version");
325-
try {
326+
if (backnd == backend::opencl) {
326327
print_info<info::device::profile, std::string>(dev, "Profile");
327-
} catch (const sycl::exception &e) {
328-
std::cout << "Expected exception has been caught: " << e.what()
329-
<< std::endl;
328+
} else {
329+
try {
330+
print_info<info::device::profile, std::string>(dev, "Profile");
331+
} catch (const sycl::exception &e) {
332+
assert(e.code() == sycl::errc::invalid &&
333+
"Expected exception has not been caught");
334+
std::cout << "Expected exception has been caught: " << e.what()
335+
<< std::endl;
336+
}
330337
}
331338
print_info<info::device::version, std::string>(dev, "Version");
332339
print_info<info::device::backend_version, std::string>(dev,
@@ -337,12 +344,19 @@ int main() {
337344
"Extensions");
338345
print_info<info::device::printf_buffer_size, size_t>(dev,
339346
"Printf buffer size");
340-
try {
347+
if (backnd == backend::opencl) {
341348
print_info<info::device::preferred_interop_user_sync, bool>(
342349
dev, "Preferred interop user sync");
343-
} catch (const sycl::exception &e) {
344-
std::cout << "Expected exception has been caught: " << e.what()
345-
<< std::endl;
350+
} else {
351+
try {
352+
print_info<info::device::preferred_interop_user_sync, bool>(
353+
dev, "Preferred interop user sync");
354+
} catch (const sycl::exception &e) {
355+
assert(e.code() == sycl::errc::invalid &&
356+
"Expected exception has not been caught");
357+
std::cout << "Expected exception has been caught: " << e.what()
358+
<< std::endl;
359+
}
346360
}
347361
try {
348362
print_info<info::device::parent_device, device>(dev, "Parent device");

0 commit comments

Comments
 (0)