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

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Mon Jan 4 11:31:27 PST 2016

From: Dylan Baker <baker.dylan.c at gmail.com>

Setting PIGLIT_NO_FAST_SKIP will disable the fast skipping mechanism

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__ = [
+# 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
+    warnings.warn('Fast Skipping Disabled')
+    FastSkipMixin = FastSkipMixinDisabled

More information about the Piglit mailing list