Skip to content
Open
Changes from 5 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
40 changes: 40 additions & 0 deletions test_conformance/api/test_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ const char *sample_two_kernel_program[] = {
"\n"
"}\n" };

const char *sample_sampler_size_test_kernel = R"(
__kernel void sampler_size_test(sampler_t sampler, __read_only image2d_t src, __global float4 *dst)
{
int tid = get_global_id(0);
int2 coord = (int2)(get_global_id(0), get_global_id(1));
float4 data = read_imagef(src, sampler, coord);
dst[tid] = data;
}
)";

const char *sample_local_size_test_kernel = R"(
__kernel void local_size_test(__local int *src, __global int *dst)
{
Expand Down Expand Up @@ -726,6 +736,36 @@ REGISTER_TEST(negative_set_immutable_memory_to_writeable_kernel_arg)
return TEST_PASS;
}

REGISTER_TEST(negative_invalid_arg_sampler)
{
PASSIVE_REQUIRE_IMAGE_SUPPORT(device)

cl_int error = CL_SUCCESS;
clProgramWrapper program;
clKernelWrapper sampler_arg_kernel;

// Setup the test
error =
create_single_kernel_helper(context, &program, nullptr, 1,
&sample_sampler_size_test_kernel, nullptr);
test_error(error, "Unable to build test program");

sampler_arg_kernel = clCreateKernel(program, "sampler_size_test", &error);
test_error(error,
"Unable to get sampler_size_test kernel for built program");

// Run the test - CL_INVALID_SAMPLER
error = clSetKernelArg(sampler_arg_kernel, 0, sizeof(cl_sampler), nullptr);
test_failure_error_ret(
error, CL_INVALID_SAMPLER,
"clSetKernelArg is supposed to fail with CL_INVALID_SAMPLER when "
"argument is declared to be of type sampler_t and the specified "
"arg_value is not a valid sampler object",
TEST_FAIL);

return TEST_PASS;
}

REGISTER_TEST(negative_invalid_kernel)
{
cl_int error = CL_SUCCESS;
Expand Down
Loading