Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_SIZE and local qalified argument (#2449)

Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
This commit is contained in:
Marcin Hajder
2025-08-08 23:06:15 +02:00
committed by GitHub
parent 3fd572dec4
commit 2e0f803699

View File

@@ -87,6 +87,14 @@ const char *sample_two_kernel_program[] = {
"\n" "\n"
"}\n" }; "}\n" };
const char *sample_local_size_test_kernel = R"(
__kernel void local_size_test(__local int *src, __global int *dst)
{
size_t tid = get_global_id(0);
dst[tid] = src[tid];
}
)";
const char *sample_read_only_image_test_kernel = R"( const char *sample_read_only_image_test_kernel = R"(
__kernel void read_only_image_test(__write_only image2d_t img, __global uint4 *src) __kernel void read_only_image_test(__write_only image2d_t img, __global uint4 *src)
{ {
@@ -718,6 +726,30 @@ REGISTER_TEST(negative_set_immutable_memory_to_writeable_kernel_arg)
return TEST_PASS; return TEST_PASS;
} }
REGISTER_TEST(negative_invalid_arg_size_local)
{
cl_int error = CL_SUCCESS;
clProgramWrapper program;
clKernelWrapper local_arg_kernel;
// Setup the test
error = create_single_kernel_helper(
context, &program, nullptr, 1, &sample_local_size_test_kernel, nullptr);
test_error(error, "Unable to build test program");
local_arg_kernel = clCreateKernel(program, "local_size_test", &error);
test_error(error, "Unable to get local_size_test kernel for built program");
// Run the test
error = clSetKernelArg(local_arg_kernel, 0, 0, nullptr);
test_failure_error_ret(
error, CL_INVALID_ARG_SIZE,
"clSetKernelArg is supposed to fail with CL_INVALID_ARG_SIZE when 0 is "
"passed to a local qualifier kernel argument",
TEST_FAIL);
return TEST_PASS;
}
REGISTER_TEST(negative_set_read_write_image_arg) REGISTER_TEST(negative_set_read_write_image_arg)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;