Skip to content

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

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test_conformance/api/test_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,31 @@ REGISTER_TEST(negative_set_immutable_memory_to_writeable_kernel_arg)
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)
{
cl_int error = CL_SUCCESS;
Expand Down
Loading