-
Notifications
You must be signed in to change notification settings - Fork 129
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 EnqueueMapBuffer #259
Open
piotr-wozniak-mobica
wants to merge
3
commits into
KhronosGroup:main
Choose a base branch
from
Mobica:ut_enqueueMapBuffer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4517,4 +4517,41 @@ void testgetObjectInfo() { | |||||||||
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER); | ||||||||||
TEST_ASSERT_EQUAL(bufobj, 0); | ||||||||||
} | ||||||||||
static void *clEnqueueMapBuffer_testenqueueMapBuffer( | ||||||||||
cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, | ||||||||||
cl_map_flags map_flags, size_t offset, size_t size, | ||||||||||
cl_uint num_events_in_wait_list, const cl_event *event_wait_list, | ||||||||||
cl_event *event, cl_int *errcode_ret, int num_calls) { | ||||||||||
(void)command_queue; | ||||||||||
TEST_ASSERT_EQUAL_PTR(make_mem(0), buffer); | ||||||||||
TEST_ASSERT_EQUAL(CL_TRUE, blocking_map); | ||||||||||
TEST_ASSERT_EQUAL(CL_MAP_WRITE, map_flags); | ||||||||||
TEST_ASSERT_EQUAL(0, offset); | ||||||||||
TEST_ASSERT_EQUAL(sizeof(int) * 1024, size); | ||||||||||
TEST_ASSERT_EQUAL(0, num_events_in_wait_list); | ||||||||||
TEST_ASSERT_EQUAL_PTR(nullptr, event_wait_list); | ||||||||||
TEST_ASSERT_NOT_NULL(event); | ||||||||||
TEST_ASSERT_NOT_EQUAL(nullptr, errcode_ret); | ||||||||||
TEST_ASSERT_EQUAL(0, num_calls); | ||||||||||
return make_mem(0); | ||||||||||
} | ||||||||||
void testenqueueMapBuffer() { | ||||||||||
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; | ||||||||||
|
||||||||||
clEnqueueMapBuffer_StubWithCallback( | ||||||||||
clEnqueueMapBuffer_testenqueueMapBuffer); | ||||||||||
ret = enqueueMapBuffer(bufferPool[0], blocking, flags, offset, size, events, | ||||||||||
event, err); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a very strong opinion about this, but it would require less code to pass in some of these values directly vs. assigning them to a variable first.
Suggested change
|
||||||||||
|
||||||||||
TEST_ASSERT_EQUAL_PTR(make_mem(0), ret); | ||||||||||
event_data() = nullptr; | ||||||||||
} | ||||||||||
} // extern "C" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event pointer is an optional output, so if the pointer is non-NULL then we should be writing a value to it (e.g.
make_event(N)
, and checking that the expected value was written in the calling function.See, for example:
OpenCL-CLHPP/tests/test_openclhpp.cpp
Lines 3772 to 3774 in f96b8f8
OpenCL-CLHPP/tests/test_openclhpp.cpp
Line 3791 in f96b8f8