[Piglit] [PATCH] util: Don't call exit() after piglit_report_result()

Ian Romanick idr at freedesktop.org
Wed May 29 14:46:19 PDT 2013


On 05/15/2013 11:29 AM, Chad Versace wrote:
> Any call to exit() that follows piglit_report_result() is nothing more
> than confusing dead code.  piglit_report_result() already calls exit(),
> and chooses the exit code according to the PIGLIT_$RESULT value.

A couple of minor things that I noticed while reviewing this patch:

  * There's a redundant exit() call after piglit_report_result in 
tests/cl/program/program-tester.c, 
tests/egl/spec/egl_khr_create_context/verify-gl-flavor.c, 
tests/fbo/fbo-draw-buffers-blend.c, and 
tests/glslparsertest/glslparsertest.c.

  * There's also a redundant exit() call not after piglit_report_result 
in tests/spec/ext_texture_integer/getteximage-clamping.c.

  * The exit() calls in 
tests/spec/ext_transform_feedback/get-buffer-state.c, 
tests/spec/ext_transform_feedback/builtin-varyings.c, and 
tests/spec/ext_transform_feedback/api-errors.c return the wrong value.

  * The exit() usage in tests/spec/amd_performance_monitor/measure.c and 
tests/spec/amd_performance_monitor/api.c are weird.

  * tests/texturing/crossbar.c should use piglit_report_result and 
remove the call to exit.

If you fix the first one, I'll send out patches that fix the others. 
With that,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>
> CC: Eric Anholt <eric at anholt.net>
> CC: Topi Pohjolainen <topi.pohjolainen at intel.com>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>   tests/util/piglit-glx-util.c       |  1 -
>   tests/util/piglit-shader-gl.c      |  4 ----
>   tests/util/piglit-util-cl.c        | 12 ------------
>   tests/util/piglit-util-gl-common.c |  4 ----
>   tests/util/piglit-util-gl.c        |  3 ---
>   5 files changed, 24 deletions(-)
>
> diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
> index 016fa46..3805618 100644
> --- a/tests/util/piglit-glx-util.c
> +++ b/tests/util/piglit-glx-util.c
> @@ -68,7 +68,6 @@ piglit_get_glx_visual(Display *dpy)
>   		fprintf(stderr,
>   			"Couldn't get an RGBA, double-buffered visual\n");
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>
>   	return visinfo;
> diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
> index 33735cc..32a7c45 100644
> --- a/tests/util/piglit-shader-gl.c
> +++ b/tests/util/piglit-shader-gl.c
> @@ -39,7 +39,6 @@ piglit_require_GLSL(void)
>   	         && piglit_is_extension_supported("GL_ARB_shading_language_100"))) {
>   		printf("GLSL not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -57,7 +56,6 @@ piglit_require_GLSL_version(int version)
>   		printf("GLSL %d.%d not supported.\n",
>   		       version / 100, version % 100);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -69,7 +67,6 @@ piglit_require_vertex_shader(void)
>   		 && piglit_is_extension_supported("GL_ARB_vertex_shader"))) {
>   		printf("GLSL vertex shaders are not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -81,6 +78,5 @@ piglit_require_fragment_shader(void)
>   		 && piglit_is_extension_supported("GL_ARB_fragment_shader"))) {
>   		printf("GLSL fragment shaders are not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
> diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> index 3bc1c82..dc0fb3a 100644
> --- a/tests/util/piglit-util-cl.c
> +++ b/tests/util/piglit-util-cl.c
> @@ -139,7 +139,6 @@ piglit_cl_get_platform_version(cl_platform_id platform)
>   		       version_string);
>   		free(version_string);
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>   	free(version_string);
>
> @@ -154,7 +153,6 @@ piglit_cl_require_platform_version(cl_platform_id platform,
>   		printf("Test requires OpenCL version %g\n",
>   		       required_version_times_10 / 10.0);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -183,7 +181,6 @@ piglit_cl_get_device_version(cl_device_id device)
>   		       version_string);
>   		free(version_string);
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>   	free(version_string);
>
> @@ -198,7 +195,6 @@ piglit_cl_require_device_version(cl_device_id device,
>   		printf("Test requires OpenCL version %g\n",
>   		       required_version_times_10 / 10.0);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -233,7 +229,6 @@ piglit_cl_get_device_cl_c_version(cl_device_id device)
>   		       version_string);
>   		free(version_string);
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>   	free(version_string);
>
> @@ -248,7 +243,6 @@ piglit_cl_require_device_cl_c_version(cl_device_id device,
>   		printf("Test requires OpenCL C version %g\n",
>   		       required_version_times_10 / 10.0);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -315,7 +309,6 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint param)
>   		        "Trying to get %s information from undefined function.\n",
>   		        piglit_cl_get_enum_name(param));
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>
>   	if(errNo == CL_SUCCESS) {
> @@ -377,7 +370,6 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint param)
>   		        piglit_cl_get_enum_name(param),
>   		        piglit_cl_get_error_name(errNo));
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>
>   	return param_ptr;
> @@ -480,7 +472,6 @@ piglit_cl_require_platform_extension(cl_platform_id platform, const char *name)
>   	if (!piglit_cl_is_platform_extension_supported(platform, name)) {
>   		printf("Test requires %s platform extension\n", name);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -491,7 +482,6 @@ piglit_cl_require_not_platform_extension(cl_platform_id platform,
>   	if (piglit_cl_is_platform_extension_supported(platform, name)) {
>   		printf("Test requires absence of %s\n platform extension\n", name);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -512,7 +502,6 @@ piglit_cl_require_device_extension(cl_device_id device, const char *name)
>   	if (!piglit_cl_is_device_extension_supported(device, name)) {
>   		printf("Test requires %s device extension\n", name);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -522,7 +511,6 @@ piglit_cl_require_not_device_extension(cl_device_id device, const char *name)
>   	if (piglit_cl_is_device_extension_supported(device, name)) {
>   		printf("Test requires absence of %s device extension\n", name);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
> index 3ee3013..d1b7d5e 100644
> --- a/tests/util/piglit-util-gl-common.c
> +++ b/tests/util/piglit-util-gl-common.c
> @@ -57,7 +57,6 @@ int piglit_get_gl_version(void)
>   		printf("Unable to interpret GL_VERSION string: %s\n",
>   		       version_string);
>   		piglit_report_result(PIGLIT_FAIL);
> -		exit(1);
>   	}
>   	return 10*major+minor;
>   }
> @@ -144,7 +143,6 @@ void piglit_require_gl_version(int required_version_times_10)
>   		printf("Test requires GL version %g\n",
>   		       required_version_times_10 / 10.0);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -153,7 +151,6 @@ void piglit_require_extension(const char *name)
>   	if (!piglit_is_extension_supported(name)) {
>   		printf("Test requires %s\n", name);
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -161,7 +158,6 @@ void piglit_require_not_extension(const char *name)
>   {
>   	if (piglit_is_extension_supported(name)) {
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
> index 25a7e75..0a56582 100644
> --- a/tests/util/piglit-util-gl.c
> +++ b/tests/util/piglit-util-gl.c
> @@ -729,7 +729,6 @@ void piglit_require_fragment_program(void)
>   	if (!piglit_use_fragment_program()) {
>   		printf("GL_ARB_fragment_program not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -744,7 +743,6 @@ void piglit_require_vertex_program(void)
>   	if (!piglit_use_vertex_program()) {
>   		printf("GL_ARB_vertex_program not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>
> @@ -1423,6 +1421,5 @@ piglit_require_transform_feedback(void)
>   	      piglit_is_extension_supported("GL_EXT_transform_feedback"))) {
>   		printf("Transform feedback not supported.\n");
>   		piglit_report_result(PIGLIT_SKIP);
> -		exit(1);
>   	}
>   }
>



More information about the Piglit mailing list