From 420ee016da71a4a5df60d2ad5f049b05cbd35871 Mon Sep 17 00:00:00 2001 From: piotr-wozniak-mobica Date: Fri, 18 Aug 2023 11:24:39 +0200 Subject: [PATCH 1/2] UT for enqueueMarkerWithWaitList --- tests/test_openclhpp.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index 7748e664..2932a1a9 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4517,4 +4517,35 @@ void testgetObjectInfo() { TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER); TEST_ASSERT_EQUAL(bufobj, 0); } +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 +static cl_int clEnqueueMarkerWithWaitList_testenqueueMarkerWithWaitList( + cl_command_queue command_queue, cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, cl_event *event, int num_calls) { + TEST_ASSERT_EQUAL_PTR(make_command_queue(0), command_queue); + TEST_ASSERT_EQUAL(1, num_events_in_wait_list); + TEST_ASSERT_NOT_NULL(event_wait_list); + TEST_ASSERT_EQUAL(0, num_calls); + if (event != nullptr) { + *event = make_event(1); + } + return CL_SUCCESS; +} + +void testenqueueMarkerWithWaitList() { + cl_int ret = CL_DEVICE_NOT_FOUND; + cl::Event event; + cl::vector events = {event}; + + clEnqueueMarkerWithWaitList_StubWithCallback( + clEnqueueMarkerWithWaitList_testenqueueMarkerWithWaitList); + ret = commandQueuePool[0].enqueueMarkerWithWaitList(&events, &event); + TEST_ASSERT_EQUAL(CL_SUCCESS, ret); + TEST_ASSERT_EQUAL_PTR(make_event(1), event()); + + event() = nullptr; + events[0]() = nullptr; +} +#else +void testenqueueMarkerWithWaitList() {} +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 } // extern "C" From 63d8b8f0059db80e2c48eae80287c1c26d60708b Mon Sep 17 00:00:00 2001 From: Kamil Goras Date: Thu, 16 Nov 2023 12:38:58 +0100 Subject: [PATCH 2/2] Changed event list --- tests/test_openclhpp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index 2932a1a9..e63e033e 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4524,6 +4524,7 @@ static cl_int clEnqueueMarkerWithWaitList_testenqueueMarkerWithWaitList( TEST_ASSERT_EQUAL_PTR(make_command_queue(0), command_queue); TEST_ASSERT_EQUAL(1, num_events_in_wait_list); TEST_ASSERT_NOT_NULL(event_wait_list); + TEST_ASSERT_EQUAL_PTR(event_wait_list[0], make_event(0)); TEST_ASSERT_EQUAL(0, num_calls); if (event != nullptr) { *event = make_event(1); @@ -4534,7 +4535,8 @@ static cl_int clEnqueueMarkerWithWaitList_testenqueueMarkerWithWaitList( void testenqueueMarkerWithWaitList() { cl_int ret = CL_DEVICE_NOT_FOUND; cl::Event event; - cl::vector events = {event}; + cl::vector events; + events.emplace_back(cl::Event(make_event(0))); clEnqueueMarkerWithWaitList_StubWithCallback( clEnqueueMarkerWithWaitList_testenqueueMarkerWithWaitList);