Commit 8c797703 authored by Dylan Baker's avatar Dylan Baker

framework/test: Split multishader too

Tested-by: Rafael Antognolli's avatarRafael Antognolli <rafael.antognolli@intel.com>
parent a3ddc621
......@@ -201,11 +201,22 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
filenames -- a list of absolute paths to shader test files
"""
def __init__(self, filenames):
def __init__(self, prog, files, subtests, skips):
super(MultiShaderTest, self).__init__(
[prog] + files,
subtests=subtests,
run_concurrent=True)
self.prog = prog
self.files = files
self.subtests = subtests
self.skips = [FastSkip(**s) for s in skips]
@classmethod
def new(cls, filenames):
# TODO
assert filenames
prog = None
files = []
subtests = []
skips = []
......@@ -215,7 +226,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
for each in filenames:
parser = Parser(each)
parser.parse()
subtest = os.path.basename(os.path.splitext(each)[0]).lower()
subtests.append(os.path.basename(os.path.splitext(each)[0]).lower())
if prog is not None:
# This allows mixing GLES2 and GLES3 shader test files
......@@ -236,30 +247,42 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
else:
prog = parser.prog
skips.append({
'gl_required': parser.gl_required,
'gl_version': parser.gl_version,
'glsl_version': parser.glsl_version,
'gles_version': parser.gles_version,
'glsl_es_version': parser.glsl_es_version,
})
return cls(prog, filenames, subtests, skips)
def _process_skips(self):
r_files = []
r_subtests = []
r_skips = []
for f, s, k in zip(self.files, self.subtests, self.skips):
try:
skipper = FastSkip(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)
skipper.test()
k.test()
except TestIsSkip:
skips.append(subtest)
continue
files.append(parser.filename)
subtests.append(subtest)
r_skips.append(s)
else:
r_files.append(f)
r_subtests.append(s)
assert len(subtests) + len(skips) == len(filenames), \
assert len(r_subtests) + len(r_skips) == len(self.files), \
'not all tests accounted for'
super(MultiShaderTest, self).__init__(
[prog] + files,
subtests=subtests,
run_concurrent=True)
for name in skips:
for name in r_skips:
self.result.subtests[name] = status.SKIP
self._expected = r_subtests
self._command = [self._command[0]] + r_files
def run(self):
self._process_skips()
super(MultiShaderTest, self).run()
@PiglitBaseTest.command.getter # pylint: disable=no-member
def command(self):
"""Add -auto to the test command."""
......
......@@ -339,7 +339,7 @@ for group, files in six.iteritems(shader_tests):
group, os.path.basename(os.path.splitext(files[0])[0]))
profile.test_list[group] = ShaderTest.new(files[0])
else:
profile.test_list[group] = MultiShaderTest(files)
profile.test_list[group] = MultiShaderTest.new(files)
# Collect and add all asmparsertests
......
......@@ -33,6 +33,7 @@ except ImportError:
import pytest
import six
from framework import status
from framework.test import shader_test
# pylint: disable=invalid-name,no-self-use,protected-access
......@@ -242,7 +243,7 @@ class TestMultiShaderTest(object):
[vertex shader]"""))
return shader_test.MultiShaderTest(
return shader_test.MultiShaderTest.new(
[six.text_type(one), six.text_type(two)])
def test_prog(self, inst):
......@@ -268,10 +269,11 @@ class TestMultiShaderTest(object):
two.write(textwrap.dedent("""\
[require]
GLSL >= 4.0
GL_ARB_ham_sandwhich
[vertex shader]"""))
return shader_test.MultiShaderTest(
return shader_test.MultiShaderTest.new(
[six.text_type(one), six.text_type(two)])
def test_resume(self, inst):
......@@ -279,3 +281,14 @@ class TestMultiShaderTest(object):
assert os.path.basename(actual[0]) == 'shader_runner'
assert os.path.basename(actual[1]) == 'bar.shader_test'
assert os.path.basename(actual[2]) == '-auto'
def test_skips_set(self, inst):
assert inst.skips[0].glsl_version == 3.0
assert inst.skips[1].glsl_version == 4.0
assert inst.skips[1].gl_required == {'GL_ARB_ham_sandwhich'}
def test_process_skips(self, inst):
expected = {'bar': status.SKIP, 'foo': status.NOTRUN}
with mock.patch.object(inst.skips[0].info, 'glsl_version', 3.0):
inst._process_skips()
assert dict(inst.result.subtests) == expected
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