[Piglit] [PATCH] framework/test/opengl.py: Add environment variable to turn off fast skipping

Jose Fonseca jfonseca at vmware.com
Mon Jan 4 13:31:21 PST 2016


Yeah, if it's not too much trouble to maintain this, it might come 
handy. Thanks.

Jose

On 04/01/16 19:31, baker.dylan.c at gmail.com wrote:
> From: Dylan Baker <baker.dylan.c at gmail.com>
>
> Setting PIGLIT_NO_FAST_SKIP will disable the fast skipping mechanism
> altogether.
>
> It does this by shadowing FastSkipMixin at import time. This method is
> robust and cheap, but makes testing difficult.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>
> Jose, Marek also ran into issues with the fast skipping. I think the
> patch you reviewed should fix it, but this also seems like a simple way
> to ensure that if users want to opt out they can. Does this look like
> something that you'd want?
>
>   framework/test/opengl.py | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> diff --git a/framework/test/opengl.py b/framework/test/opengl.py
> index 9cad32c..6c0df06 100644
> --- a/framework/test/opengl.py
> +++ b/framework/test/opengl.py
> @@ -24,6 +24,7 @@ from __future__ import absolute_import, division, print_function
>   import errno
>   import os
>   import subprocess
> +import warnings
>
>   from framework import exceptions, core
>   from framework.options import OPTIONS
> @@ -35,6 +36,10 @@ __all__ = [
>       'FastSkipMixin',
>   ]
>
> +# An environment variable that when set to true disables the Fast Skip Mixin
> +# by stubbing it out
> +_DISABLED = bool(os.environ.get('PIGLIT_NO_FAST_SKIP', False))
> +
>
>   class StopWflinfo(exceptions.PiglitException):
>       """Exception called when wlfinfo getter should stop."""
> @@ -364,3 +369,23 @@ class FastSkipMixin(object):
>                       self.glsl_es_version, self.__info.glsl_es_version))
>
>           super(FastSkipMixin, self).is_skip()
> +
> +
> +class FastSkipMixinDisabled(object):
> +    def __init__(self, *args, **kwargs):
> +        # Tests that implement the FastSkipMixin expect to have these values
> +        # set, so just fill them in with the default values.
> +        self.gl_required = set()
> +        self.gl_version = None
> +        self.gles_version = None
> +        self.glsl_version = None
> +        self.glsl_es_version = None
> +
> +        super(FastSkipMixinDisabled, self).__init__(*args, **kwargs)
> +
> +
> +# Shadow the real FastSkipMixin with the Disabled version if
> +# PIGLIT_NO_FAST_SKIP is truthy
> +if _DISABLED:
> +    warnings.warn('Fast Skipping Disabled')
> +    FastSkipMixin = FastSkipMixinDisabled
>



More information about the Piglit mailing list