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

Dylan Baker baker.dylan.c at gmail.com
Thu Mar 31 17:34:11 UTC 2016


Quoting Brian Paul (2016-03-30 18:03:37)
> 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
> 
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit

I've seen this pattern a few times, maybe this could be added to the
TODO file as a good beginner project?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160331/2081b084/attachment.sig>


More information about the Piglit mailing list