|
16 | 16 | #include "testBase.h" |
17 | 17 | #include "harness/typeWrappers.h" |
18 | 18 | #include "harness/conversions.h" |
| 19 | +#include "harness/featureHelpers.h" |
19 | 20 | #include "harness/stringHelpers.h" |
20 | 21 | #include <array> |
21 | 22 | #include <vector> |
@@ -89,6 +90,17 @@ const char *sample_two_kernel_program[] = { |
89 | 90 | "\n" |
90 | 91 | "}\n" }; |
91 | 92 |
|
| 93 | +const char *sample_queue_test_kernel = R"( |
| 94 | + __kernel void enqueue_call_func() { |
| 95 | + } |
| 96 | + __kernel void queue_test(queue_t queue) |
| 97 | + { |
| 98 | + ndrange_t ndrange = ndrange_1D(1); |
| 99 | + enqueue_kernel(queue, CLK_ENQUEUE_FLAGS_WAIT_KERNEL, ndrange, |
| 100 | + ^{enqueue_call_func();}); |
| 101 | + } |
| 102 | +)"; |
| 103 | + |
92 | 104 | const char *sample_sampler_size_test_kernel = R"( |
93 | 105 | __kernel void sampler_size_test(sampler_t sampler, __read_only image2d_t src, __global float4 *dst) |
94 | 106 | { |
@@ -754,6 +766,51 @@ REGISTER_TEST(negative_set_immutable_memory_to_writeable_kernel_arg) |
754 | 766 | return TEST_PASS; |
755 | 767 | } |
756 | 768 |
|
| 769 | +REGISTER_TEST(negative_invalid_arg_queue) |
| 770 | +{ |
| 771 | + OpenCLCFeatures features; |
| 772 | + get_device_cl_c_features(device, features); |
| 773 | + |
| 774 | + const Version clc_version = get_device_latest_cl_c_version(device); |
| 775 | + if (clc_version < Version(2, 0) |
| 776 | + || (clc_version >= Version(3, 0) |
| 777 | + && !features.supports__opencl_c_device_enqueue)) |
| 778 | + return TEST_SKIPPED_ITSELF; |
| 779 | + |
| 780 | + std::string build_opts = "-cl-std=CL" + clc_version.to_string(); |
| 781 | + |
| 782 | + cl_int error = CL_SUCCESS; |
| 783 | + clProgramWrapper program; |
| 784 | + clKernelWrapper queue_arg_kernel; |
| 785 | + clCommandQueueWrapper queue_arg; |
| 786 | + |
| 787 | + // Setup the test |
| 788 | + error = create_single_kernel_helper(context, &program, &queue_arg_kernel, 1, |
| 789 | + &sample_queue_test_kernel, "queue_test", |
| 790 | + build_opts.c_str()); |
| 791 | + test_error(error, "Unable to create test kernel"); |
| 792 | + |
| 793 | + // Run the test - CL_INVALID_DEVICE_QUEUE |
| 794 | + error = clSetKernelArg(queue_arg_kernel, 0, sizeof(cl_command_queue), |
| 795 | + &queue_arg); |
| 796 | + test_failure_error_ret( |
| 797 | + error, CL_INVALID_DEVICE_QUEUE, |
| 798 | + "clSetKernelArg is supposed to fail with CL_INVALID_DEVICE_QUEUE when " |
| 799 | + "the specified arg_value is not a valid device queue object", |
| 800 | + TEST_FAIL); |
| 801 | + |
| 802 | + // Run the test with host-side queue and expect CL_INVALID_DEVICE_QUEUE |
| 803 | + error = |
| 804 | + clSetKernelArg(queue_arg_kernel, 0, sizeof(cl_command_queue), queue); |
| 805 | + test_failure_error_ret( |
| 806 | + error, CL_INVALID_DEVICE_QUEUE, |
| 807 | + "clSetKernelArg is supposed to fail with CL_INVALID_DEVICE_QUEUE when " |
| 808 | + "the specified arg_value is not a valid device queue object", |
| 809 | + TEST_FAIL); |
| 810 | + |
| 811 | + return TEST_PASS; |
| 812 | +} |
| 813 | + |
757 | 814 | REGISTER_TEST(negative_invalid_arg_sampler) |
758 | 815 | { |
759 | 816 | PASSIVE_REQUIRE_IMAGE_SUPPORT(device) |
|
0 commit comments