[Piglit] [PATCH v3] gl30basic: add some extra suspected extension

sandra koroniewska sandra.koroniewska at gmail.com
Wed Jun 28 11:47:29 UTC 2017


"The logic here seems dubious to me. How can the inner if statement ever be
true,
given that you've already checked that the extension string is empty or
starts
with 'GL_'?"

Strncmp returns 0 if contents of both strings are equal, so it checks that
the string does not start with "GL_".

"if (!ext || strncmp(ext, "GL_", 3) || strncmp(ext, "WGL_EXT_swap_control",
20)) {
...
}"

So this will not work, because if string begins with "GL_" the third
condition will be met and PIGLIT_FAIL will be returned.

But you have a point when it comes to the first condition (!ext). I will
extract this one and check the others after this.
I will also add a comment about WGL_EXT_swap_control and update the patch.

Thanks,
Sandra

On Tue, Jun 27, 2017 at 6:41 PM, Dylan Baker <dylan at pnwbakers.com> wrote:

> Quoting Sandra Koroniewska (2017-06-27 06:52:02)
> > WGL_EXT_SWAP_CONTROL is added for historical reasons.
> > ---
> >  tests/general/gl30basic.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/general/gl30basic.c b/tests/general/gl30basic.c
> > index 2207787bb..d6bcd34ad 100644
> > --- a/tests/general/gl30basic.c
> > +++ b/tests/general/gl30basic.c
> > @@ -95,12 +95,13 @@ test_extension_list(void)
> >        const GLubyte *ext = glGetStringi(GL_EXTENSIONS, k);
> >        if (0)
> >           printf("Ext[%d] = %s\n", k, (char *) ext);
> > -      if (!ext ||
> > -          ext[0] != 'G' ||
> > -          ext[1] != 'L' ||
> > -          ext[2] != '_') {
> > -         printf("%s: bad extension string [%d]: %s\n", Prog, k, ext);
> > -         return PIGLIT_FAIL;
> > +      if (!ext || strncmp(ext, "GL_", 3))
> > +      {
> > +          if (strncmp(ext, "WGL_EXT_swap_control", 20))
> > +          {
> > +              printf("%s: bad extension string [%d]: %s\n", Prog, k,
> ext);
> > +              return PIGLIT_FAIL;
> > +          }
> >        }
>
> The logic here seems dubious to me. How can the inner if statement ever be
> true,
> given that you've already checked that the extension string is empty or
> starts
> with 'GL_'? Also, unless I'm misreading this the PIGLIT_FAIL will only be
> generated if the extension is WGL_EXT_swap_control, which also seems wrong.
>
> I think this should be:
>
> if (!ext || strncmp(ext, "GL_", 3) || strncmp(ext, "WGL_EXT_swap_control",
> 20)) {
> ...
> }
>
> Dylan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170628/677b7b12/attachment-0001.html>


More information about the Piglit mailing list