Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UT for enqueueReleaseGLObjects #260

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4517,4 +4517,38 @@ void testgetObjectInfo() {
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER);
TEST_ASSERT_EQUAL(bufobj, 0);
}
static cl_int clEnqueueReleaseGLObjects_testenqueueReleaseGLObjects(
cl_command_queue command_queue, cl_uint num_objects,
const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
const cl_event *event_wait_list, cl_event *event, int num_calls) {
(void)command_queue;
TEST_ASSERT_EQUAL(1, num_objects);
TEST_ASSERT_NOT_NULL(mem_objects);
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 testenqueueReleaseGLObjects() {
cl::Memory obj;
cl::vector<cl::Memory> mem_objects = {obj};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mem_objects (and hence obj) are input values to the function we are testing, so we need to ensure they are passed through correctly. We should be able to use an object from the bufferPool for it.

cl::Event event;
cl::vector<cl::Event> events = {event};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See related comment: #257 (comment)

cl_int ret = CL_INVALID_COMMAND_QUEUE;

clEnqueueReleaseGLObjects_StubWithCallback(
clEnqueueReleaseGLObjects_testenqueueReleaseGLObjects);
ret = commandQueuePool[0].enqueueReleaseGLObjects(&mem_objects, &events,
&event);
TEST_ASSERT_EQUAL(CL_SUCCESS, ret);
TEST_ASSERT_EQUAL_PTR(make_event(1), event());

event() = nullptr;
events[0]() = nullptr;
mem_objects[0]() = nullptr;
}
} // extern "C"