Skip to content

Commit b74c55a

Browse files
committed
[CTS] Check if images are supported before testing
Add checks on the value of the `UR_DEVICE_INFO_IMAGE_SUPPORTED` device query to the image test fixtures, skip the tests if images are not supported.
1 parent 7371150 commit b74c55a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/conformance/testing/include/uur/fixtures.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ struct urMemBufferTest : urContextTest {
180180
struct urMemImageTest : urContextTest {
181181
void SetUp() override {
182182
UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp());
183+
ur_bool_t imageSupported = false;
184+
ASSERT_SUCCESS(
185+
urDeviceGetInfo(this->device, UR_DEVICE_INFO_IMAGE_SUPPORTED,
186+
sizeof(ur_bool_t), &imageSupported, nullptr));
187+
if (!imageSupported) {
188+
GTEST_SKIP();
189+
}
183190
}
184191

185192
void TearDown() override {
@@ -276,6 +283,13 @@ template <class T> struct urMemBufferTestWithParam : urContextTestWithParam<T> {
276283
template <class T> struct urMemImageTestWithParam : urContextTestWithParam<T> {
277284
void SetUp() override {
278285
UUR_RETURN_ON_FATAL_FAILURE(urContextTestWithParam<T>::SetUp());
286+
ur_bool_t imageSupported = false;
287+
ASSERT_SUCCESS(
288+
urDeviceGetInfo(this->device, UR_DEVICE_INFO_IMAGE_SUPPORTED,
289+
sizeof(ur_bool_t), &imageSupported, nullptr));
290+
if (!imageSupported) {
291+
GTEST_SKIP();
292+
}
279293
ASSERT_SUCCESS(urMemImageCreate(this->context, UR_MEM_FLAG_READ_WRITE,
280294
&format, &desc, nullptr, &image));
281295
ASSERT_NE(nullptr, image);
@@ -551,6 +565,13 @@ struct urMemBufferQueueTest : urQueueTest {
551565
struct urMemImageQueueTest : urQueueTest {
552566
void SetUp() override {
553567
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
568+
ur_bool_t imageSupported = false;
569+
ASSERT_SUCCESS(
570+
urDeviceGetInfo(this->device, UR_DEVICE_INFO_IMAGE_SUPPORTED,
571+
sizeof(ur_bool_t), &imageSupported, nullptr));
572+
if (!imageSupported) {
573+
GTEST_SKIP();
574+
}
554575
ASSERT_SUCCESS(urMemImageCreate(this->context, UR_MEM_FLAG_READ_WRITE,
555576
&format, &desc1D, nullptr, &image1D));
556577

@@ -626,6 +647,15 @@ struct urMemImageQueueTest : urQueueTest {
626647
struct urMultiDeviceMemImageTest : urMultiDeviceContextTest {
627648
void SetUp() override {
628649
UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceContextTest::SetUp());
650+
for (auto device : DevicesEnvironment::instance->devices) {
651+
ur_bool_t imageSupported = false;
652+
ASSERT_SUCCESS(
653+
urDeviceGetInfo(device, UR_DEVICE_INFO_IMAGE_SUPPORTED,
654+
sizeof(ur_bool_t), &imageSupported, nullptr));
655+
if (!imageSupported) {
656+
GTEST_SKIP();
657+
}
658+
}
629659
ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
630660
&format, &desc1D, nullptr, &image1D));
631661

0 commit comments

Comments
 (0)