[Piglit] [PATCH] fbo-fragcoord2: Convert asserts to failure reports.

Brian Paul brianp at vmware.com
Thu Mar 31 01:03:37 UTC 2016


On 03/30/2016 05:58 PM, Vinson Lee wrote:
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/fbo/fbo-fragcoord2.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/tests/fbo/fbo-fragcoord2.c b/tests/fbo/fbo-fragcoord2.c
> index 34a5c6cf7802..e816a9800cd6 100644
> --- a/tests/fbo/fbo-fragcoord2.c
> +++ b/tests/fbo/fbo-fragcoord2.c
> @@ -220,11 +220,17 @@ piglit_init(int argc, char**argv)
>      piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
>
>      vs = piglit_compile_shader_text(GL_VERTEX_SHADER, VertShaderText);
> -   assert(vs);
> +   if (!vs) {
> +      piglit_report_result(PIGLIT_FAIL);
> +   }
>
>      fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
> -   assert(fs);
> +   if (!fs) {
> +      piglit_report_result(PIGLIT_FAIL);
> +   }
>
>      prog = piglit_link_simple_program(vs, fs);
> -   assert(prog);
> +   if (!prog) {
> +      piglit_report_result(PIGLIT_FAIL);
> +   }
>   }
>

Actually that whole section could be simplified with:

prog = piglit_build_simple_program(VertShaderText, FragShaderText);

That function will check if linking fails and call 
piglit_report_result(PIGLIT_FAIL) so need to check the return value.

-Brian




More information about the Piglit mailing list