Commit 8786e154 authored by Dylan Baker's avatar Dylan Baker

tests/glsl_parser_test.py: fix is_skip for serialized profiles

Currently is_skip() relies on runtime detection of which glslparsertest
binaries are built, but we can't assume that at build time. Instead
always assign the appropriate binary, and then check for the existence
of that binary at run time.
Tested-by: Rafael Antognolli's avatarRafael Antognolli <rafael.antognolli@intel.com>
parent 1be0b641
......@@ -122,7 +122,7 @@ class Parser(object):
# If GLES is requested, but piglit was not built with a gles version,
# then ARB_ES3<ver>_compatibility is required. Add it to
# self.gl_required
if self.glsl_es_version and not _HAS_GLES_BIN:
if self.glsl_es_version and _FORCE_DESKTOP_VERSION:
if self.glsl_es_version == 1.0:
ver = '2'
elif self.glsl_es_version == 3.0:
......@@ -148,14 +148,10 @@ class Parser(object):
then the test will be skipped in the python layer.
"""
if (_is_gles_version(version)
and _HAS_GLES_BIN
and not _FORCE_DESKTOP_VERSION):
if _is_gles_version(version) and not _FORCE_DESKTOP_VERSION:
return 'glslparsertest_gles2'
elif _HAS_GL_BIN:
return 'glslparsertest'
else:
return 'None'
return 'glslparsertest'
def get_command(self, filepath):
""" Create the command argument to pass to super()
......@@ -295,8 +291,12 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
glsl_es_version=parsed.glsl_es_version)
def is_skip(self):
if os.path.basename(self.command[0]) == 'None':
raise TestIsSkip('Test is for desktop OpenGL, '
'but only an OpenGL ES binary has been built')
if os.path.basename(self.command[0]) == 'glslparsertest' and not _HAS_GL_BIN:
raise TestIsSkip('Test is for desktop OpenGL, but piglit was not '
'built with OpenGL support.')
elif (os.path.basename(self.command[0]) == 'glslparsertest_gles2'
and not _HAS_GLES_BIN):
raise TestIsSkip('Test is for OpenGL ES, but piglit was not '
'built with OpenGL ES support.')
super(GLSLParserTest, self).is_skip()
......@@ -339,22 +339,21 @@ def test_valid_extensions(ext, tmpdir):
@pytest.mark.parametrize(
"version,has_bin,forced",
"version,forced",
itertools.product(
['1.00', '3.00', '3.10', '3.20', '3.00 es', '3.10 es', '3.20 es'],
[True, False], [True, False]))
def test_get_glslparsertest_gles2(version, has_bin, forced, tmpdir, mocker):
[True, False]))
def test_get_glslparsertest_gles2(version, forced, tmpdir, mocker):
"""Tests for assigning the correct binary for GLES tests.
Tests with and without the gles binary and with and without the force
desktop mode.
"""
if not has_bin or forced:
if forced:
expected = 'glslparsertest'
else:
expected = 'glslparsertest_gles2'
mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', has_bin)
mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION',
forced)
......@@ -436,7 +435,7 @@ def test_add_compatibility_requirement_fastskip(version, extension, tmpdir,
This test checks the fast skipping variable
"""
mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', False)
mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', True)
p = tmpdir.join('test.frag')
p.write(textwrap.dedent("""\
......@@ -466,7 +465,7 @@ def test_add_compatibility_requirement_binary(version, extension, tmpdir,
This test checks the glslparsertest binary command line.
"""
mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', False)
mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', True)
p = tmpdir.join('test.frag')
p.write(textwrap.dedent("""\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment