Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_INDEX (#2458)

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-12 17:40:13 +02:00
committed by GitHub
parent 2e0f803699
commit 4115d04ae0

View File

@@ -726,6 +726,31 @@ REGISTER_TEST(negative_set_immutable_memory_to_writeable_kernel_arg)
return TEST_PASS; return TEST_PASS;
} }
REGISTER_TEST(negative_invalid_arg_index)
{
cl_int error = CL_SUCCESS;
clProgramWrapper program;
clKernelWrapper kernel;
// Setup the test
error = create_single_kernel_helper(context, &program, nullptr, 1,
sample_single_test_kernel, nullptr);
test_error(error, "Unable to build test program");
kernel = clCreateKernel(program, "sample_test", &error);
test_error(error, "Unable to get sample_test kernel for built program");
// Run the test - 2 index is out or range - expected CL_INVALID_ARG_INDEX
error = clSetKernelArg(kernel, 2, sizeof(cl_mem), nullptr);
test_failure_error_ret(
error, CL_INVALID_ARG_INDEX,
"clSetKernelArg is supposed to fail with CL_INVALID_ARG_INDEX when "
"arg_index is not a valid argument index",
TEST_FAIL);
return TEST_PASS;
}
REGISTER_TEST(negative_invalid_arg_size_local) REGISTER_TEST(negative_invalid_arg_size_local)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;