Skip to content

Commit a106550

Browse files
authored
[UR] Handle adapters returning no platforms during testing (#17410)
When initialising tests, adapters may return no platforms. This patch ensures that that doesn't cause a failure unless there are no platforms in any adapter.
1 parent d2ce65e commit a106550

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

unified-runtime/test/conformance/source/environment.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,19 @@ void uur::PlatformEnvironment::populatePlatforms() {
8080
for (auto a : adapters) {
8181
uint32_t count = 0;
8282
ASSERT_SUCCESS(urPlatformGet(&a, 1, 0, nullptr, &count));
83+
if (count == 0) {
84+
continue;
85+
}
8386
std::vector<ur_platform_handle_t> platform_list(count);
8487
ASSERT_SUCCESS(urPlatformGet(&a, 1, count, platform_list.data(), nullptr));
8588

8689
for (auto p : platform_list) {
8790
platforms.push_back(p);
8891
}
8992
}
93+
94+
ASSERT_FALSE(platforms.empty())
95+
<< "No platforms are available on any adapters";
9096
}
9197

9298
void uur::PlatformEnvironment::SetUp() {

0 commit comments

Comments
 (0)