summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-08-30 16:57:48 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-10-07 14:50:12 -0700
commitb4e766f62c59af891136a7b190255728b43883e2 (patch)
tree9b8dc7f08789c7da98f7f843672e5317c2a16f1e /unittests
parent3f9cc4fe54144022cce651a4439be41d749c2c8a (diff)
framework: Add class for running multiple shader_tests in a single process
This adds a class based on the ReducedProcessMixin that allows the python layer to understand the output of shader_runner when it runs more than one test per process. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'unittests')
-rw-r--r--unittests/framework/test/test_shader_test.py63
1 files changed, 62 insertions, 1 deletions
diff --git a/unittests/framework/test/test_shader_test.py b/unittests/framework/test/test_shader_test.py
index 9cf8b6042..c62aee3f8 100644
--- a/unittests/framework/test/test_shader_test.py
+++ b/unittests/framework/test/test_shader_test.py
@@ -33,7 +33,6 @@ except ImportError:
import pytest
import six
-from framework import exceptions
from framework.test import shader_test
# pylint: disable=invalid-name,no-self-use
@@ -204,3 +203,65 @@ def test_command_add_auto(tmpdir):
test = shader_test.ShaderTest(six.text_type(p))
assert '-auto' in test.command
+
+
+class TestMultiShaderTest(object):
+ """Tests for the MultiShaderTest class."""
+
+ class TestConstructor(object):
+ """Tests for the constructor object."""
+
+ @pytest.fixture
+ def inst(self, tmpdir):
+ """A fixture that creates an instance to test."""
+ one = tmpdir.join('foo.shader_test')
+ one.write(textwrap.dedent("""\
+ [require]
+ GLSL >= 3.0
+
+ [vertex shader]"""))
+ two = tmpdir.join('bar.shader_test')
+ two.write(textwrap.dedent("""\
+ [require]
+ GLSL >= 4.0
+
+ [vertex shader]"""))
+
+ return shader_test.MultiShaderTest(
+ [six.text_type(one), six.text_type(two)])
+
+ def test_prog(self, inst):
+ assert os.path.basename(inst.command[0]) == 'shader_runner'
+
+ def test_filenames(self, inst):
+ assert os.path.basename(inst.command[1]) == 'foo.shader_test'
+ assert os.path.basename(inst.command[2]) == 'bar.shader_test'
+
+ def test_extra(self, inst):
+ assert inst.command[3] == '-auto'
+
+ @pytest.fixture
+ def inst(self, tmpdir):
+ """A fixture that creates an instance to test."""
+ one = tmpdir.join('foo.shader_test')
+ one.write(textwrap.dedent("""\
+ [require]
+ GLSL >= 3.0
+
+ [vertex shader]"""))
+ two = tmpdir.join('bar.shader_test')
+ two.write(textwrap.dedent("""\
+ [require]
+ GLSL >= 4.0
+
+ [vertex shader]"""))
+
+ return shader_test.MultiShaderTest(
+ [six.text_type(one), six.text_type(two)])
+
+ def test_resume(self, inst):
+ actual = inst._resume(1) # pylint: disable=protected-access
+ assert os.path.basename(actual[0]) == 'shader_runner'
+ assert os.path.basename(actual[1]) == 'bar.shader_test'
+ assert os.path.basename(actual[2]) == '-auto'
+