-
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 createSubBuffer #254
Open
piotr-wozniak-mobica
wants to merge
3
commits into
KhronosGroup:main
Choose a base branch
from
Mobica:ut_createSubBuffer
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,37 @@ void testgetObjectInfo() { | |||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER); | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(bufobj, 0); | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
#if CL_HPP_TARGET_OPENCL_VERSION >= 110 | ||||||||||||||||||||||||||||||
static cl_mem clCreateSubBuffer_testCreateSubBuffer( | ||||||||||||||||||||||||||||||
cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, | ||||||||||||||||||||||||||||||
const void *buffer_create_info, cl_int *errcode_ret, int num_calls) { | ||||||||||||||||||||||||||||||
(void)errcode_ret; | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(make_mem(0), buffer); | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(0, flags); | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(0, buffer_create_type); | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL_PTR(nullptr, buffer_create_info); | ||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL(0, num_calls); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
return make_mem(1); | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
void testCreateSubBuffer() { | ||||||||||||||||||||||||||||||
#ifndef CL_HPP_ENABLE_EXCEPTIONS | ||||||||||||||||||||||||||||||
cl_mem_flags flags = 0; | ||||||||||||||||||||||||||||||
cl_buffer_create_type buffer_create_type = 0; | ||||||||||||||||||||||||||||||
const void *buffer_create_info = nullptr; | ||||||||||||||||||||||||||||||
cl_int *err = nullptr; | ||||||||||||||||||||||||||||||
static cl::Buffer ret; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
clCreateSubBuffer_StubWithCallback(clCreateSubBuffer_testCreateSubBuffer); | ||||||||||||||||||||||||||||||
ret = bufferPool[0].createSubBuffer(flags, buffer_create_type, | ||||||||||||||||||||||||||||||
buffer_create_info, err); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
TEST_ASSERT_EQUAL_PTR(make_mem(1), ret()); | ||||||||||||||||||||||||||||||
ret() = nullptr; | ||||||||||||||||||||||||||||||
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. Please make this variable non-static:
Suggested change
|
||||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||
void testCreateSubBuffer() {} | ||||||||||||||||||||||||||||||
#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 | ||||||||||||||||||||||||||||||
} // 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.
We really ought to be testing more real-world values here:
buffer
- this one is OK.flags
- a value of0
is legal, but it's not a very useful value to test to see if the flags are being passed through properly. Maybe pass something likeCL_MEM_READ_ONLY
instead?buffer_create_type
- this should beCL_BUFFER_CREATE_TYPE_REGION
, since this is the only buffer creation type described in the spec.buffer_create_info
- this should be a non-NULL pointer to acl_buffer_region
structure. Ideally, we should check that the pointer is non-NULL, and that the contents of the structure are what we expect.