summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-08-16 14:02:52 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-08-23 11:39:20 -0700
commit67e82910c756061faf77b54009dcff04fda86b52 (patch)
treeb88c9f5a18d40af81780dea2ae4cd659b317153a
parent7e9c1fc84740a676ea5d2baf3a2ed89e174ebc8e (diff)
framework: fix PIGLIT_NO_FAST_SKIP.
The signature of the stub version was not updated when the real version was, which means setting the environment variable will raise an exception. Also adds some tests for this problem. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Tested-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--framework/test/opengl.py6
-rw-r--r--unittests/framework/test/test_opengl.py41
2 files changed, 45 insertions, 2 deletions
diff --git a/framework/test/opengl.py b/framework/test/opengl.py
index 51c8f194a..6fe867007 100644
--- a/framework/test/opengl.py
+++ b/framework/test/opengl.py
@@ -382,7 +382,9 @@ class FastSkipMixin(object):
class FastSkipMixinDisabled(object):
- def __init__(self, *args, **kwargs):
+ def __init__(self, command, gl_required=None, gl_version=None,
+ gles_version=None, glsl_version=None, glsl_es_version=None,
+ **kwargs): # pylint: disable=too-many-arguments
# Tests that implement the FastSkipMixin expect to have these values
# set, so just fill them in with the default values.
self.gl_required = set()
@@ -391,7 +393,7 @@ class FastSkipMixinDisabled(object):
self.glsl_version = None
self.glsl_es_version = None
- super(FastSkipMixinDisabled, self).__init__(*args, **kwargs)
+ super(FastSkipMixinDisabled, self).__init__(command, **kwargs)
# Shadow the real FastSkipMixin with the Disabled version if
diff --git a/unittests/framework/test/test_opengl.py b/unittests/framework/test/test_opengl.py
index e782d33bb..63813738d 100644
--- a/unittests/framework/test/test_opengl.py
+++ b/unittests/framework/test/test_opengl.py
@@ -417,6 +417,16 @@ class TestFastSkipMixin(object): # pylint: disable=too-many-public-methods
def inst(self):
return self._Test(['foo'])
+ def test_api(self):
+ """Tests that the api works.
+
+ Since you're not suppoed to be able to pass gl and gles version, this
+ uses two seperate constructor calls.
+ """
+ self._Test(['foo'], gl_required={'foo'}, gl_version=3, glsl_version=2)
+ self._Test(['foo'], gl_required={'foo'}, gles_version=3,
+ glsl_es_version=2)
+
def test_should_skip(self, inst):
"""test.opengl.FastSkipMixin.is_skip: Skips when requires is missing
from extensions.
@@ -554,3 +564,34 @@ class TestFastSkipMixin(object): # pylint: disable=too-many-public-methods
def test_max_glsl_es_version_set(self, inst):
"""test.opengl.FastSkipMixin.is_skip: runs if glsl_es_version is None"""
inst.is_skip()
+
+
+class TestFastSkipMixinDisabled(object):
+ """Tests for the sub version."""
+
+ @pytest.yield_fixture(autouse=True, scope='class')
+ def patch(self):
+ """Create a Class with FastSkipMixin, but patch various bits."""
+ _mock_wflinfo = mock.Mock(spec=opengl.WflInfo)
+ _mock_wflinfo.gl_version = 3.3
+ _mock_wflinfo.gles_version = 3.0
+ _mock_wflinfo.glsl_version = 3.3
+ _mock_wflinfo.glsl_es_version = 2.0
+ _mock_wflinfo.gl_extensions = set(['bar'])
+
+ with mock.patch.object(self._Test, '_FastSkipMixin__info',
+ _mock_wflinfo):
+ yield
+
+ class _Test(opengl.FastSkipMixin, utils.Test):
+ pass
+
+ def test_api(self):
+ """Tests that the api works.
+
+ Since you're not suppoed to be able to pass gl and gles version, this
+ uses two seperate constructor calls.
+ """
+ self._Test(['foo'], gl_required={'foo'}, gl_version=3, glsl_version=2)
+ self._Test(['foo'], gl_required={'foo'}, gles_version=3,
+ glsl_es_version=2)