From e82b9b88d942d425711eaaa2cea298c6a8d66af8 Mon Sep 17 00:00:00 2001 From: piotr-wozniak-mobica Date: Wed, 9 Aug 2023 15:12:01 +0200 Subject: [PATCH 1/2] UT for enqueueBarrierWithWaitList --- tests/test_openclhpp.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index 7748e664..a41875bd 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4517,4 +4517,34 @@ 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 clEnqueueBarrierWithWaitList_testEnqueueBarrierWithWaitList( + 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 testEnqueueBarrierWithWaitList() { + cl_int ret = CL_DEVICE_NOT_FOUND; + cl::Event event; + cl::vector events = {event}; + + clEnqueueBarrierWithWaitList_StubWithCallback( + clEnqueueBarrierWithWaitList_testEnqueueBarrierWithWaitList); + ret = commandQueuePool[0].enqueueBarrierWithWaitList(&events, &event); + TEST_ASSERT_EQUAL(CL_SUCCESS, ret); + TEST_ASSERT_EQUAL_PTR(make_event(1), event()); + event() = nullptr; + events[0]() = nullptr; +} +#else +void testEnqueueBarrierWithWaitList() {} +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 } // extern "C" From b8c2b657c2f9620fbcc34e85150c3e4b71fff90e Mon Sep 17 00:00:00 2001 From: Kamil Goras Date: Tue, 21 Nov 2023 12:55:07 +0100 Subject: [PATCH 2/2] Added code correction --- 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 601917e3..3f7916aa 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4579,6 +4579,7 @@ static cl_int clEnqueueBarrierWithWaitList_testEnqueueBarrierWithWaitList( 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(event_wait_list[0], make_event(0)); TEST_ASSERT_EQUAL(0, num_calls); if (event != nullptr) { *event = make_event(1); @@ -4589,7 +4590,8 @@ static cl_int clEnqueueBarrierWithWaitList_testEnqueueBarrierWithWaitList( void testEnqueueBarrierWithWaitList() { 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))); clEnqueueBarrierWithWaitList_StubWithCallback( clEnqueueBarrierWithWaitList_testEnqueueBarrierWithWaitList);