[Piglit] [PATCH] all.py: fix extension/version testing when wflinfo fails

Dylan Baker dylan at pnwbakers.com
Fri Feb 2 18:57:49 UTC 2018


Quoting Brian Paul (2018-02-02 09:35:21)
> If wflinfo is not installed or fails, the wfl_info.gl_extensions value
> will be the empty set.  Similarly, the gl_version, glsl_version, etc.
> will be None.
> 
> In those cases, return True from the gl_extension_supported() and
> is_feature_directory_supported() functions so that we don't skip any
> subdirs.
> 
> This is only relevant when PIGLIT_FILTER_DIRECTORIES is set.
> ---
>  tests/all.py | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 6d4e887..eece906 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -217,6 +217,10 @@ wfl_info = wflinfo.WflInfo()
>  
>  def gl_extension_supported(ext_name):
>      """Is the named OpenGL extension supported?"""
> +    if wfl_info.gl_extensions == set():

I think we should just do 'if not wfl_info.gl_extensions' here.

> +        # Don't know what extensions are supported.  Return true so we don't
> +        # skip anything.
> +        return True
>      return ext_name in wfl_info.gl_extensions
>  
>  
> @@ -227,6 +231,9 @@ def is_feature_directory_supported(dir_name):
>      it means the extension/version is possibly suppported.  We're a little
>      fuzzy because we don't yet parse all the directory name possibilities
>      (like ES tests).
> +
> +    Also, if the 'wflinfo' program is not installed or fails (i.e. we can't
> +    determine the GL version/extension) we return True.
>      """
>      if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
>          # The directory is a GL extension name, but of the format "arb_foo_bar"
> @@ -237,19 +244,19 @@ def is_feature_directory_supported(dir_name):
>      elif dir_name[:5] == "gles-":
>          # OpenGL ES test
>          version = float(dir_name[5:])
> -        return wfl_info.gles_version != None and version <= wfl_info.gles_version
> +        return wfl_info.gles_version == None or version <= wfl_info.gles_version

I know this uses != with None, but we really should be using `is` and `is not`
with None.

>      elif dir_name[:8] == "glsl-es-":
>          # OpenGL ES shader test
>          version = float(dir_name[8:])
> -        return wfl_info.glsl_es_version != None and version <= wfl_info.glsl_es_version
> +        return wfl_info.glsl_es_version == None or version <= wfl_info.glsl_es_version
>      elif dir_name[:3] == "gl-":
>          # The directory is a GL version
>          version = float(dir_name[3:])
> -        return version <= wfl_info.gl_version
> +        return wfl_info.gl_version == None or version <= wfl_info.gl_version
>      elif dir_name[:5] == "glsl-":
>          # The directory is a GLSL version
>          version = float(dir_name[5:])
> -        return version <= wfl_info.glsl_version
> +        return wfl_info.glsl_version == None or version <= wfl_info.glsl_version
>      else:
>          # The directory is something else.  Don't skip it.
>          return True

With  the nits above fixed,
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180202/274d43b3/attachment.sig>


More information about the Piglit mailing list