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 enqueueUnmapMemObject #263

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
38 changes: 38 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4571,6 +4571,44 @@ void testgetObjectInfo() {
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER);
TEST_ASSERT_EQUAL(bufobj, 0);
}

static cl_int clEnqueueUnmapMemObject_testenqueueUnmapMemObject(
cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr,
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_PTR(make_mem(0), memobj);
TEST_ASSERT_EQUAL_PTR(mapped_ptr, some_host_memory);
TEST_ASSERT_EQUAL(0, num_events_in_wait_list);
TEST_ASSERT_EQUAL_PTR(nullptr, event_wait_list);
TEST_ASSERT_NOT_NULL(event);
TEST_ASSERT_EQUAL(0, num_calls);
event = nullptr;
return CL_DEVICE_NOT_FOUND;
}

void testenqueueUnmapMemObject() {
#ifndef CL_HPP_ENABLE_EXCEPTIONS
cl_bool blocking = CL_TRUE;
cl_map_flags flags = CL_MAP_WRITE;
cl::size_type offset = 0;
cl::size_type size = sizeof(int) * 1024;
cl::Event event_data(make_event(0), false);
cl::Event *event = &event_data;
const cl::vector<cl::Event> *events = nullptr;
cl_int *err = nullptr;
void *ret = nullptr;
cl_int ret_unmap = CL_SUCCESS;

clEnqueueUnmapMemObject_StubWithCallback(
clEnqueueUnmapMemObject_testenqueueUnmapMemObject);
ret_unmap = commandQueuePool[0].enqueueUnmapMemObject(
bufferPool[0], some_host_memory, events, event);
TEST_ASSERT_EQUAL(CL_DEVICE_NOT_FOUND, ret_unmap);
event_data() = nullptr;
#endif
}

#if CL_HPP_TARGET_OPENCL_VERSION >= 210
static cl_int clGetHostTimer_testgetHostTimer(cl_device_id device,
cl_ulong *host_timestamp,
Expand Down