[Piglit] [PATCH 1/1] cl: Split setKernelArg into subtests

Jan Vesely jan.vesely at rutgers.edu
Wed Mar 9 15:53:48 UTC 2016


On Sat, 2016-03-05 at 16:18 +0100, Serge Martin wrote:
> 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.

this does not work. in the presence of subtests the global result is
composed from subtest results. In this specific case, intel CPU driver
passes all tests but one input check, yet the result looks like this:
## Test: clSetKernelArg (/home/vesely/piglit/tests/cl/api/set-kernel-
arg.c) ##

# Running on:
#   Platform: Intel(R) OpenCL
#   Device:         Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
#   OpenCL version: 1.2
Unexpected CL error: CL_SUCCESS 0
Expected CL error: CL_INVALID_ARG_SIZE -51
# Result:


and the generated html (whitespace adjusted):
    <table>
      <colgroup><col /> <col /></colgroup>
      <tr><th/><th class="head"><b>foo</b><br />(<a ref="foo/index.html">info</a>)</th></tr>
      <tr><td class="head"><b>all</b></td><td class="pass"><b>7/7</b>/td></tr>
      <tr><td><div class="head" style="margin-left: 1.75em"><b>api</b></div></td><td class="pass"><b>7/7</b></td></tr>
      <tr><td><div class="head" style="margin-left: 3.5em"><b>clsetkernelarg</b></div></td><td class="pass"><b>7/7</b></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for array</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for buffer</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for buffer which is NULL</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for cl_int3</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for sampler</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for scalar</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
      <tr><td><div class="group" style="margin-left: 5.25em">Set kernel argument for struct</div></td>
          <td class="pass"><a href="foo/api at clsetkernelarg.html">pass</a></td></tr>
    </table>

it might be a piglit bug, but even piglit-run reported the test as pass.

> 
> I think reporting error as subtest is a little to verbose. May be we
> could 
> make a subtest report for the whole error case?

Even if the above behaviour is a piglit bug, I'd find it weird if a
test reported failure when all reported subtests pass.
v2 coalesces all input checks into one subtest to reduce verbosity.


thanks,
Jan

> 
> > 
> > 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_e
> > rror_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_e
> > rror_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);
> >  	}
> > 
> >  	/*
-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160309/435e3cde/attachment.sig>


More information about the Piglit mailing list