Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions offload/unittests/OffloadAPI/common/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ const std::vector<TestEnvironment::Device> &TestEnvironment::getDevices() {
}
}

if (Devices.size() <= 1)
errs() << "Warning: No devices found for OffloadAPI tests.\n";

return Devices;
}

Expand Down
6 changes: 5 additions & 1 deletion offload/unittests/OffloadAPI/common/Fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,13 @@ struct OffloadEventTest : OffloadQueueTest {
ol_event_handle_t Event = nullptr;
};

// Devices might not be available for offload testing, so allow uninstantiated
// tests (as the device list will be empty). This means that all tests requiring
// a device will be silently skipped.
#define OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(FIXTURE) \
INSTANTIATE_TEST_SUITE_P( \
, FIXTURE, ::testing::ValuesIn(TestEnvironment::getDevices()), \
[](const ::testing::TestParamInfo<TestEnvironment::Device> &info) { \
return SanitizeString(info.param.Name); \
})
}); \
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FIXTURE)
Loading