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

Ilia Mirkin imirkin at alum.mit.edu
Wed Jun 28 12:31:12 UTC 2017


You did test this, right?

On Wed, Jun 28, 2017 at 8:02 AM, Sandra Koroniewska
<sandra.koroniewska at gmail.com> wrote:
> 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..11d90bed7 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){

if () { -- note the spacing. Here and elsewhere.

> +          if (strncmp(ext, "GL_", 3)) {

OK, so ... ext is NULL (we only enter here if !ext) ... and then you
strcmp it to something? Sounds off.

> +              if (strncmp(ext, "WGL_EXT_swap_control", 20)){ // In some drivers WGL_EXT_swap_control is in the extension string for historical reasons

C comments please (i.e.  /* ... */ )

Also, to avoid the long line (80 chars is the recommendation), place
the comment above the if statement.

Why strncmp? Are you trying to allow WGL_EXT_swap_control,
WGL_EXT_swap_control_blah, etc? AFAIK it's just the one...

Any reason not to combine this all into one? I think this would be
nice and simple and cover all cases:

if (!ext || (strncmp(ext, "GL_", 3) != 0 && strcmp(ext,
"WGL_EXT_swap_control") != 0)) {
  printf(...);
}

> +                  printf("%s: bad extension string [%d]: %s\n", Prog, k, ext);
> +                  return PIGLIT_FAIL;
> +              }
> +          }
>        }
>        if (strchr((char *) ext, ' ')) {
>           printf("%s: extension string [%d] contains a space: %s\n", Prog, k, ext);
> --
> 2.11.0.windows.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list