[Piglit] [PATCH] cl: fix invalid platform test in create-context
Tom Stellard
tom at stellard.net
Mon Aug 17 07:08:26 PDT 2015
On Fri, Aug 14, 2015 at 09:05:48PM +0200, Serge Martin (EdB) wrote:
> OpenCL objects are just pointers in the end, using random pointer value
> is likely to make an application crash.
> Also, all others tests use NULL as an invalid object.
>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> See also Francisco Jerez comments:
> http://lists.freedesktop.org/archives/mesa-dev/2014-November/070520.html
> http://lists.freedesktop.org/archives/mesa-dev/2013-October/046830.html
> ---
> tests/cl/api/create-context.c | 16 +---------------
> 1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/tests/cl/api/create-context.c b/tests/cl/api/create-context.c
> index f4929f0..551f8a2 100644
> --- a/tests/cl/api/create-context.c
> +++ b/tests/cl/api/create-context.c
> @@ -139,7 +139,7 @@ piglit_cl_test(const int argc,
> bool found_invalid_platform = false;
> cl_platform_id* platform_ids;
> unsigned int num_platform_ids;
> - cl_platform_id invalid_platform_id;
> + cl_platform_id invalid_platform_id = NULL;
>
> //TODO: test also CL_CONTEXT_INTEROP_USER_SYNC
> cl_context_properties context_properties[] = {
> @@ -160,20 +160,6 @@ piglit_cl_test(const int argc,
> 0
> };
>
> - /* Find invalid platform_id */
> - invalid_platform_id = 0;
> - num_platform_ids = piglit_cl_get_platform_ids(&platform_ids);
> - while(!found_invalid_platform) {
> - found_invalid_platform = true;
> - invalid_platform_id = (cl_platform_id)1;
> - for(i = 0; i < num_platform_ids; i++) {
> - if(invalid_platform_id == platform_ids[i]) {
> - found_invalid_platform = false;
> - break;
> - }
> - }
> - }
> - free(platform_ids);
> invalid_platform_context_properties[1] =
> (cl_context_properties)invalid_platform_id;
>
> --
> 2.5.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list