Skip to content

Commit d427229

Browse files
committed
rework get info test so devicedefault and size is in another suite
1 parent 4994af5 commit d427229

File tree

8 files changed

+71
-55
lines changed

8 files changed

+71
-55
lines changed

bisect.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
urQueueGetInfoTest.DeviceDefault/*
2-
urQueueGetInfoTest.Size/*
1+
urQueueGetInfoDeviceQueueTestWithInfoParam.DeviceDefault/*
2+
urQueueGetInfoDeviceQueueTestWithInfoParam.Size/*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
urQueueGetInfoTest.DeviceDefault/*
2-
urQueueGetInfoTest.Size/*
1+
urQueueGetInfoDeviceQueueTestWithInfoParam.DeviceDefault/*
2+
urQueueGetInfoDeviceQueueTestWithInfoParam.Size/*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
urQueueGetInfoTest.DeviceDefault/*
2-
urQueueGetInfoTest.Size/*
1+
urQueueGetInfoDeviceQueueTestWithInfoParam.DeviceDefault/*
2+
urQueueGetInfoDeviceQueueTestWithInfoParam.Size/*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
urQueueGetInfoTest.DeviceDefault/*
2-
urQueueGetInfoTest.Size/*
1+
urQueueGetInfoDeviceQueueTestWithInfoParam.DeviceDefault/*
2+
urQueueGetInfoDeviceQueueTestWithInfoParam.Size/*

test/conformance/queue/queue_adapter_native_cpu.match

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ urQueueCreateWithParamTest.MatchingDeviceHandles/*
55
urQueueFlushTest.Success/*
66
urQueueGetInfoTest.Context/*
77
urQueueGetInfoTest.Device/*
8-
urQueueGetInfoTest.DeviceDefault/*
98
urQueueGetInfoTest.Flags/*
109
urQueueGetInfoTest.ReferenceCount/*
1110
urQueueGetInfoTest.EmptyQueue/*
1211
urQueueGetInfoTest.InvalidSizeSmall/*
12+
urQueueGetInfoDeviceQueueTestWithInfoParam.DeviceDefault/*
1313
urQueueRetainTest.Success/*
1414
urQueueReleaseTest.Success/*

test/conformance/queue/urQueueGetInfo.cpp

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ TEST_P(urQueueGetInfoTest, Device) {
3737
ASSERT_EQ(device, *returned_device);
3838
}
3939

40-
TEST_P(urQueueGetInfoTest, DeviceDefault) {
41-
size_t size = 0;
42-
auto infoType = UR_QUEUE_INFO_DEVICE_DEFAULT;
43-
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, 0, nullptr, &size));
44-
ASSERT_NE(size, 0);
45-
ASSERT_EQ(sizeof(ur_queue_handle_t), size);
46-
47-
std::vector<uint8_t> data(size);
48-
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, size, data.data(), nullptr));
49-
50-
auto returned_default_queue =
51-
reinterpret_cast<ur_queue_handle_t *>(data.data());
52-
ASSERT_EQ(queue, *returned_default_queue);
53-
}
54-
5540
TEST_P(urQueueGetInfoTest, Flags) {
5641
size_t size = 0;
5742
auto infoType = UR_QUEUE_INFO_FLAGS;
@@ -80,20 +65,6 @@ TEST_P(urQueueGetInfoTest, ReferenceCount) {
8065
ASSERT_GT(*returned_reference_count, 0U);
8166
}
8267

83-
TEST_P(urQueueGetInfoTest, Size) {
84-
size_t size = 0;
85-
auto infoType = UR_QUEUE_INFO_SIZE;
86-
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, 0, nullptr, &size));
87-
ASSERT_NE(size, 0);
88-
ASSERT_EQ(sizeof(uint32_t), size);
89-
90-
std::vector<uint8_t> data(size);
91-
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, size, data.data(), nullptr));
92-
93-
auto returned_size = reinterpret_cast<uint32_t *>(data.data());
94-
ASSERT_GT(*returned_size, 0);
95-
}
96-
9768
TEST_P(urQueueGetInfoTest, EmptyQueue) {
9869
size_t size = 0;
9970
auto infoType = UR_QUEUE_INFO_EMPTY;
@@ -152,3 +123,64 @@ TEST_P(urQueueGetInfoTest, InvalidNullPointerPropSizeRet) {
152123
UR_RESULT_ERROR_INVALID_NULL_POINTER,
153124
urQueueGetInfo(queue, UR_QUEUE_INFO_CONTEXT, 0, nullptr, nullptr));
154125
}
126+
127+
struct urQueueGetInfoDeviceQueueTestWithInfoParam : public uur::urQueueTest {
128+
void SetUp() {
129+
urQueueGetInfoTest::SetUp();
130+
ur_queue_flags_t deviceQueueCapabilities;
131+
ASSERT_SUCCESS(
132+
urDeviceGetInfo(device, UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES,
133+
sizeof(deviceQueueCapabilities),
134+
&deviceQueueCapabilities, nullptr));
135+
if (!deviceQueueCapabilities) {
136+
GTEST_SKIP() << "Queue on device is not supported.";
137+
}
138+
ASSERT_SUCCESS(
139+
urQueueCreate(context, device, &queueProperties, &queue));
140+
}
141+
142+
void TearDown() {
143+
if (queue) {
144+
ASSERT_SUCCESS(urQueueRelease(queue));
145+
}
146+
urQueueGetInfoTest::TearDown();
147+
}
148+
149+
ur_queue_handle_t queue = nullptr;
150+
ur_queue_properties_t queueProperties = {
151+
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES, nullptr,
152+
UR_QUEUE_FLAG_ON_DEVICE | UR_QUEUE_FLAG_ON_DEVICE_DEFAULT |
153+
UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE};
154+
};
155+
156+
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urQueueGetInfoDeviceQueueTestWithInfoParam);
157+
158+
TEST_P(urQueueGetInfoDeviceQueueTestWithInfoParam, DeviceDefault) {
159+
160+
size_t size = 0;
161+
auto infoType = UR_QUEUE_INFO_DEVICE_DEFAULT;
162+
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, 0, nullptr, &size));
163+
ASSERT_NE(size, 0);
164+
ASSERT_EQ(sizeof(ur_queue_handle_t), size);
165+
166+
std::vector<uint8_t> data(size);
167+
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, size, data.data(), nullptr));
168+
169+
auto returned_queue = reinterpret_cast<ur_queue_handle_t *>(data.data());
170+
ASSERT_EQ(queue, *returned_queue);
171+
}
172+
173+
TEST_P(urQueueGetInfoDeviceQueueTestWithInfoParam, Size) {
174+
175+
size_t size = 0;
176+
auto infoType = UR_QUEUE_INFO_SIZE;
177+
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, 0, nullptr, &size));
178+
ASSERT_NE(size, 0);
179+
ASSERT_EQ(sizeof(uint32_t), size);
180+
181+
std::vector<uint8_t> data(size);
182+
ASSERT_SUCCESS(urQueueGetInfo(queue, infoType, size, data.data(), nullptr));
183+
184+
auto returned_size = reinterpret_cast<uint32_t *>(data.data());
185+
ASSERT_GT(*returned_size, 0);
186+
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ struct urQueueTest : urContextTest {
365365
}
366366

367367
ur_queue_properties_t queue_properties = {
368-
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES, nullptr,
369-
UR_QUEUE_FLAG_ON_DEVICE | UR_QUEUE_FLAG_ON_DEVICE_DEFAULT |
370-
UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE};
368+
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES, nullptr, 0};
371369
ur_queue_handle_t queue = nullptr;
372370
};
373371

0 commit comments

Comments
 (0)