diff --git a/test_conformance/api/test_kernels.cpp b/test_conformance/api/test_kernels.cpp index a8d02558..fc619bf8 100644 --- a/test_conformance/api/test_kernels.cpp +++ b/test_conformance/api/test_kernels.cpp @@ -87,6 +87,14 @@ const char *sample_two_kernel_program[] = { "\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"( __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; } +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) { cl_int error = CL_SUCCESS;