Skip to content

Commit e20013b

Browse files
authored
Merge pull request #2687 from isaacault/event-cts
Improvements to align CTS and Spec for Event.
2 parents 9edff97 + 272cb7f commit e20013b

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

test/conformance/event/urEventCreateWithNativeHandle.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,27 @@ TEST_P(urEventCreateWithNativeHandleTest, SuccessWithProperties) {
5656
sizeof(ur_execution_info_t), &exec_info,
5757
nullptr));
5858
}
59+
60+
TEST_P(urEventCreateWithNativeHandleTest, InvalidNullHandle) {
61+
ur_native_handle_t native_event = 0;
62+
63+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
64+
urEventGetNativeHandle(event, &native_event));
65+
66+
uur::raii::Event evt = nullptr;
67+
ASSERT_EQ_RESULT(
68+
urEventCreateWithNativeHandle(native_event, nullptr, nullptr, evt.ptr()),
69+
UR_RESULT_ERROR_INVALID_NULL_HANDLE);
70+
}
71+
72+
TEST_P(urEventCreateWithNativeHandleTest, InvalidNullPointer) {
73+
ur_native_handle_t native_event = 0;
74+
75+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
76+
urEventGetNativeHandle(event, &native_event));
77+
78+
uur::raii::Event evt = nullptr;
79+
ASSERT_EQ_RESULT(
80+
urEventCreateWithNativeHandle(native_event, context, nullptr, nullptr),
81+
UR_RESULT_ERROR_INVALID_NULL_POINTER);
82+
}

test/conformance/event/urEventGetProfilingInfo.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,41 @@ TEST_P(urEventGetProfilingInfoForWaitWithBarrier, Success) {
215215

216216
ASSERT_GE(complete_value, submit_value);
217217
}
218+
219+
struct urEventGetProfilingInfoInvalidQueue : uur::urQueueTest {
220+
void SetUp() override {
221+
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
222+
ASSERT_SUCCESS(urMemBufferCreate(context, UR_MEM_FLAG_WRITE_ONLY, size,
223+
nullptr, &buffer));
224+
225+
input.assign(count, 42);
226+
ASSERT_SUCCESS(urEnqueueMemBufferWrite(queue, buffer, false, 0, size,
227+
input.data(), 0, nullptr, &event));
228+
ASSERT_SUCCESS(urEventWait(1, &event));
229+
}
230+
231+
void TearDown() override {
232+
if (buffer) {
233+
EXPECT_SUCCESS(urMemRelease(buffer));
234+
}
235+
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::TearDown());
236+
};
237+
238+
const size_t count = 1024;
239+
const size_t size = sizeof(uint32_t) * count;
240+
ur_mem_handle_t buffer = nullptr;
241+
ur_event_handle_t event = nullptr;
242+
std::vector<uint32_t> input;
243+
};
244+
245+
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEventGetProfilingInfoInvalidQueue);
246+
247+
TEST_P(urEventGetProfilingInfoInvalidQueue, ProfilingInfoNotAvailable) {
248+
UUR_KNOWN_FAILURE_ON(uur::NativeCPU{});
249+
250+
const ur_profiling_info_t property_name = UR_PROFILING_INFO_COMMAND_QUEUED;
251+
size_t property_size;
252+
ASSERT_EQ_RESULT(
253+
urEventGetProfilingInfo(event, property_name, 0, nullptr, &property_size),
254+
UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE);
255+
}

test/conformance/event/urEventSetCallback.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,11 @@ TEST_P(urEventSetCallbackNegativeTest, InvalidEnumeration) {
189189
UR_RESULT_ERROR_INVALID_ENUMERATION);
190190
}
191191

192+
TEST_P(urEventSetCallbackNegativeTest, UnsupportedEnumeration) {
193+
ASSERT_EQ_RESULT(
194+
urEventSetCallback(event, ur_execution_info_t::UR_EXECUTION_INFO_QUEUED,
195+
emptyCallback, nullptr),
196+
UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION);
197+
}
198+
192199
UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEventSetCallbackNegativeTest);

0 commit comments

Comments
 (0)