Skip to content

Commit

Permalink
Skip RunPropArrayInfoTest if there are no properties
Browse files Browse the repository at this point in the history
When there are no properties, the value passed as `param_value_size` is
-1, but since the argument is of type `size_t`, this is interpreted as a
really big value (and hence not an invalid value, as the test intends).

Moreover, if the `command_buffer` was created without properties, then
even a size of 0 is large enough to store them. This test requires
`command_buffer` to have properties for there to be invalid values for
`param_value_size`.

Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
  • Loading branch information
gorazd-sumkovski-arm committed Sep 12, 2024
1 parent 6b90977 commit 4396d03
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,22 @@ struct GetCommandBufferInfo : public BasicCommandBufferTest

cl_int RunPropArrayInfoTest()
{
std::vector<cl_command_buffer_properties_khr> properties;
properties.resize(number_of_properties);

cl_int error = clGetCommandBufferInfoKHR(
command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR,
number_of_properties * sizeof(cl_command_buffer_properties_khr) - 1,
properties.data(), nullptr);

test_failure_error_ret(error, CL_INVALID_VALUE,
"clGetCommandBufferInfoKHR should return "
"CL_INVALID_VALUE",
TEST_FAIL);
if (0 != number_of_properties)
{
std::vector<cl_command_buffer_properties_khr> properties;
properties.resize(number_of_properties);

cl_int error = clGetCommandBufferInfoKHR(
command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR,
number_of_properties * sizeof(cl_command_buffer_properties_khr)
- 1,
properties.data(), nullptr);

test_failure_error_ret(error, CL_INVALID_VALUE,
"clGetCommandBufferInfoKHR should return "
"CL_INVALID_VALUE",
TEST_FAIL);
}

return TEST_PASS;
}
Expand Down

0 comments on commit 4396d03

Please sign in to comment.