[Piglit] [PATCH 1/1] cl: Split setKernelArg into subtests
Serge Martin
edb+piglit at sigluy.net
Sat Mar 5 15:18:29 UTC 2016
On Monday 29 February 2016 10:45:47 Jan Vesely wrote:
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> applies on top of Serge's changes.
In get-mem-object-info.c we only make subtest reporting for positive case,
error path been reported globally.
I think reporting error as subtest is a little to verbose. May be we could
make a subtest report for the whole error case?
> Jan
>
> tests/cl/api/set-kernel-arg.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/tests/cl/api/set-kernel-arg.c b/tests/cl/api/set-kernel-arg.c
> index 471fea1..61a16b7 100644
> --- a/tests/cl/api/set-kernel-arg.c
> +++ b/tests/cl/api/set-kernel-arg.c
> @@ -90,10 +90,12 @@ test (cl_kernel kernel,
> if(!piglit_cl_check_error(errNo, expected_error)) {
> fprintf(stderr, "Failed (error code: %s): %s.\n",
> piglit_cl_get_error_name(errNo), test_str);
> + piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_str);
> piglit_merge_result(result, PIGLIT_FAIL);
> return false;
> }
>
> + piglit_report_subtest_result(PIGLIT_PASS, "%s", test_str);
> return true;
> }
>
> @@ -110,10 +112,11 @@ piglit_cl_test(const int argc,
> } struct_arg_t;
>
> enum piglit_result result = PIGLIT_PASS;
> + const char * test_str = NULL;
>
> cl_int errNo;
> cl_kernel kernel;
> -
> +
> cl_mem buffer;
> cl_float float_num = 1.1;
> cl_int int_num = 1;
> @@ -175,6 +178,8 @@ piglit_cl_test(const int argc,
> test(kernel, 3, sizeof(cl_sampler), &sampler,
> CL_SUCCESS, &result,
> "Set kernel argument for sampler");
> + } else {
> + piglit_report_subtest_result(PIGLIT_SKIP, "%s", "Set kernel argument
for
> sampler"); }
>
> test(kernel, 4, sizeof(cl_int3), &vec3,
> @@ -232,28 +237,35 @@ piglit_cl_test(const int argc,
> * CL_INVALID_MEM_OBJECT for an argument declared to be a memory object
> when * the specified arg_value is not a valid memory object.
> */
> + test_str = "Trigger CL_INVALID_MEM_OBJECT for an argument declared to be a
> memory object when the specified arg_value is not a valid memory object.";
> errNo = clSetKernelArg(kernel, 0, sizeof(cl_mem), &invalid_buffer); if(
> errNo != CL_INVALID_MEM_OBJECT
> && errNo != CL_INVALID_ARG_VALUE) { // two possible values
> piglit_cl_check_error(errNo, CL_INVALID_MEM_OBJECT);
> fprintf(stderr,
> - "Failed (error code: %s): Trigger CL_INVALID_MEM_OBJECT for an
> argument declared to be a memory object when the specified arg_value is not
> a valid memory object.\n", - piglit_cl_get_error_name(errNo));
> + "Failed (error code: %s): %s\n",
> + piglit_cl_get_error_name(errNo), test_str);
> + piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_str);
> piglit_merge_result(&result, PIGLIT_FAIL);
> + } else {
> + piglit_report_subtest_result(PIGLIT_PASS, "%s", test_str);
> }
>
> /*
> * CL_INVALID_SAMPLER for an argument declared to be of type sampler_t
> when * the specified arg_value is not a valid sampler object.
> */
> + test_str = "Trigger CL_INVALID_SAMPLER for an argument declared to be a
> memory object when the specified arg_value is not a valid memory object.";
> errNo = clSetKernelArg(kernel, 3, sizeof(cl_sampler), NULL);
> if( errNo != CL_INVALID_SAMPLER
> && errNo != CL_INVALID_ARG_VALUE) { // two possible values
> piglit_cl_check_error(errNo, CL_INVALID_SAMPLER);
> - fprintf(stderr,
> - "Failed (error code: %s): Trigger CL_INVALID_SAMPLER for an
> argument declared to be a memory object when the specified arg_value is not
> a valid memory object.\n", - piglit_cl_get_error_name(errNo));
> + fprintf(stderr, "Failed (error code: %s): %s.\n",
> + piglit_cl_get_error_name(errNo), test_str);
> + piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_str);
> piglit_merge_result(&result, PIGLIT_FAIL);
> + } else {
> + piglit_report_subtest_result(PIGLIT_PASS, "%s", test_str);
> }
>
> /*
More information about the Piglit
mailing list