Commit a3ddc621 authored by Dylan Baker's avatar Dylan Baker

framework: do the same for shader test

Tested-by: Rafael Antognolli's avatarRafael Antognolli <rafael.antognolli@intel.com>
parent fd84fca6
......@@ -154,26 +154,31 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
"""
def __init__(self, filename):
if bool(os.environ.get('PIGLIT_NO_FAST_SKIP', False)):
# No need to parse the shader test file if we've disabled
# the FastSkip feature.
super(ShaderTest, self).__init__(
['shader_runner', filename],
run_concurrent=True,)
else:
parser = Parser(filename)
parser.parse()
super(ShaderTest, self).__init__(
[parser.prog, parser.filename],
run_concurrent=True,
gl_required=parser.gl_required,
gl_version=parser.gl_version,
gles_version=parser.gles_version,
glsl_version=parser.glsl_version,
glsl_es_version=parser.glsl_es_version)
def __init__(self, command, gl_required=set(), gl_version=None,
gles_version=None, glsl_version=None, glsl_es_version=None,
**kwargs):
super(ShaderTest, self).__init__(
command,
run_concurrent=True,
gl_required=gl_required,
gl_version=gl_version,
gles_version=gles_version,
glsl_version=glsl_version,
glsl_es_version=glsl_es_version)
@classmethod
def new(cls, filename):
parser = Parser(filename)
parser.parse()
return cls(
[parser.prog, parser.filename],
run_concurrent=True,
gl_required=parser.gl_required,
gl_version=parser.gl_version,
gles_version=parser.gles_version,
glsl_version=parser.glsl_version,
glsl_es_version=parser.glsl_es_version)
@PiglitBaseTest.command.getter
def command(self):
......@@ -197,6 +202,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
"""
def __init__(self, filenames):
# TODO
assert filenames
prog = None
files = []
......
......@@ -305,7 +305,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
testname, ext = os.path.splitext(filename)
if ext == '.shader_test':
if PROCESS_ISOLATION:
test = ShaderTest(os.path.join(dirpath, filename))
test = ShaderTest.new(os.path.join(dirpath, filename))
else:
shader_tests[groupname].append(os.path.join(dirpath, filename))
continue
......@@ -337,7 +337,7 @@ for group, files in six.iteritems(shader_tests):
if len(files) == 1:
group = grouptools.join(
group, os.path.basename(os.path.splitext(files[0])[0]))
profile.test_list[group] = ShaderTest(files[0])
profile.test_list[group] = ShaderTest.new(files[0])
else:
profile.test_list[group] = MultiShaderTest(files)
......
......@@ -93,7 +93,7 @@ class TestConfigParsing(object):
[next section]
""".format(operator, gles)))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert os.path.basename(test.command[0]) == expected
......@@ -105,7 +105,7 @@ class TestConfigParsing(object):
GL ES >= 3.0
GLSL ES >= 3.00 es
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert os.path.basename(test.command[0]) == "shader_runner_gles3"
......@@ -117,7 +117,7 @@ class TestConfigParsing(object):
GL >= 3.0
GL_ARB_ham_sandwhich
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.gl_required == {'GL_ARB_ham_sandwhich'}
......@@ -129,7 +129,7 @@ class TestConfigParsing(object):
GL >= 2.0
GL_ARB_ham_sandwhich
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.gl_version == 2.0
......@@ -141,7 +141,7 @@ class TestConfigParsing(object):
GL ES >= 2.0
GL_ARB_ham_sandwhich
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.gles_version == 2.0
......@@ -153,7 +153,7 @@ class TestConfigParsing(object):
GL >= 2.1
GLSL >= 1.20
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.glsl_version == 1.2
......@@ -165,7 +165,7 @@ class TestConfigParsing(object):
GL ES >= 2.0
GLSL ES >= 1.00
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.glsl_es_version == 1.0
......@@ -185,7 +185,7 @@ class TestConfigParsing(object):
GL_MAX_VARYING_COMPONENTS
GL_ARB_foobar
"""))
test = shader_test.ShaderTest(six.text_type(p))
test = shader_test.ShaderTest.new(six.text_type(p))
assert test.gl_version == 3.3
assert test.glsl_version == 1.50
......@@ -208,13 +208,13 @@ class TestCommand(object):
def test_getter_adds_auto_and_fbo(self, test_file):
"""test.shader_test.ShaderTest: -auto and -fbo is added to the command.
"""
test = shader_test.ShaderTest(test_file)
test = shader_test.ShaderTest.new(test_file)
assert '-auto' in test.command
assert '-fbo' in test.command
def test_setter_doesnt_add_auto_and_fbo(self, test_file):
"""Don't add -fbo or -auto to self._command when using the setter."""
test = shader_test.ShaderTest(test_file)
test = shader_test.ShaderTest.new(test_file)
test.command += ['-newarg']
assert '-auto' not in test._command
assert '-fbo' not in test._command
......
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