From 194cc94f2a62207832bb02033d5520fa7f367e0b Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Thu, 5 Jun 2025 11:34:18 -0700 Subject: [PATCH 1/2] if there are absolutely no platforms, then just skip this test --- sycl/unittests/allowlist/DeviceIsAllowed.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sycl/unittests/allowlist/DeviceIsAllowed.cpp b/sycl/unittests/allowlist/DeviceIsAllowed.cpp index bc8ba08671549..e960f8778bf86 100644 --- a/sycl/unittests/allowlist/DeviceIsAllowed.cpp +++ b/sycl/unittests/allowlist/DeviceIsAllowed.cpp @@ -95,6 +95,11 @@ TEST(DeviceIsAllowedTests, CheckLocalizationDoesNotImpact) { // We want to make sure that DeviceVenderId doesn't have a comma // inserted (ie "0x8,086" ), which will break the platform retrieval. + size_t pre_platforms_size = sycl::platform::get_platforms().size(); + if (pre_platforms_size == 0) { + GTEST_SKIP() << "No SYCL platforms found."; + } + try { auto previous = std::locale::global(std::locale("en_US.UTF-8")); #ifdef _WIN32 From 420ac28c49c62ad117712c763a5918f1954cb6cc Mon Sep 17 00:00:00 2001 From: Chris Perkins Date: Fri, 6 Jun 2025 09:36:49 -0700 Subject: [PATCH 2/2] Update sycl/unittests/allowlist/DeviceIsAllowed.cpp Co-authored-by: Alexey Bader --- sycl/unittests/allowlist/DeviceIsAllowed.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/unittests/allowlist/DeviceIsAllowed.cpp b/sycl/unittests/allowlist/DeviceIsAllowed.cpp index e960f8778bf86..e19bb6b5309b5 100644 --- a/sycl/unittests/allowlist/DeviceIsAllowed.cpp +++ b/sycl/unittests/allowlist/DeviceIsAllowed.cpp @@ -95,8 +95,7 @@ TEST(DeviceIsAllowedTests, CheckLocalizationDoesNotImpact) { // We want to make sure that DeviceVenderId doesn't have a comma // inserted (ie "0x8,086" ), which will break the platform retrieval. - size_t pre_platforms_size = sycl::platform::get_platforms().size(); - if (pre_platforms_size == 0) { + if (sycl::platform::get_platforms().empty()) { GTEST_SKIP() << "No SYCL platforms found."; }