diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-08-09 11:42:56 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-08-10 10:41:22 -0700 |
commit | 892f6e44723eda8d4f98ca8850f0fefee3e0f638 (patch) | |
tree | 356fffbc39ef511f83deaa03b2387c1b5c0d3531 /unittests/framework/test | |
parent | 4eb43934bfc3e8ebaff685cc2ef2a5d2ef3c371f (diff) |
framework: fix binary assignment for shader_runner
Currently the python layer tries to dispatch shader_tests to the right
binary (gles2, gles3 or gl). But the implementation is pretty dumb. It
basically assumes either >= or == are the only operators used, and makes
wrong assignments for < or <=, which are allowed. Is also only
understands 2.0 and 3.0 as GLES versions, which is problematic.
This version uses the closes equivalent of a match statement that python
has, to try to pick the right GLES version, otherwise it uses the GL
version. It also shares this picking mechanism with the Fast Skip
mechanism, so they always have the same result.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
cc: mark.a.janes@intel.com
cc: currojerez@riseup.net
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'unittests/framework/test')
-rw-r--r-- | unittests/framework/test/test_shader_test.py | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/unittests/framework/test/test_shader_test.py b/unittests/framework/test/test_shader_test.py index bd54624dc..9cf8b6042 100644 --- a/unittests/framework/test/test_shader_test.py +++ b/unittests/framework/test/test_shader_test.py @@ -63,28 +63,40 @@ teardown_module = _setup.teardown class TestConfigParsing(object): """Tests for ShaderRunner config parsing.""" - def test_no_decimal(self, tmpdir): - """test.shader_test.ShaderTest: raises if version lacks decminal.""" + @pytest.mark.parametrize('gles,operator,expected', [ + # pylint: disable=bad-whitespace + ('2.0', '>=', 'shader_runner_gles2'), + ('2.0', '<=', 'shader_runner_gles2'), + ('2.0', '=', 'shader_runner_gles2'), + ('2.0', '>', 'shader_runner_gles3'), + ('3.0', '>=', 'shader_runner_gles3'), + ('3.0', '<=', 'shader_runner_gles2'), + ('3.0', '=', 'shader_runner_gles3'), + ('3.0', '>', 'shader_runner_gles3'), + ('3.0', '<', 'shader_runner_gles2'), + ('3.1', '>=', 'shader_runner_gles3'), + ('3.1', '<=', 'shader_runner_gles2'), + ('3.1', '=', 'shader_runner_gles3'), + ('3.1', '>', 'shader_runner_gles3'), + ('3.1', '<', 'shader_runner_gles2'), + ('3.2', '>=', 'shader_runner_gles3'), + ('3.2', '<=', 'shader_runner_gles2'), + ('3.2', '=', 'shader_runner_gles3'), + ('3.2', '<', 'shader_runner_gles2'), + ]) + def test_bin(self, gles, operator, expected, tmpdir): + """Test that the shader_runner parse picks the correct binary.""" p = tmpdir.join('test.shader_test') p.write(textwrap.dedent("""\ [require] - GL = 2 - """)) - - with pytest.raises(exceptions.PiglitFatalError): - shader_test.ShaderTest(six.text_type(p)) - - def test_gles2_bin(self, tmpdir): - """test.shader_test.ShaderTest: Identifies GLES2 tests successfully.""" - p = tmpdir.join('test.shader_test') - p.write(textwrap.dedent("""\ - [require] - GL ES >= 2.0 + GL ES {} {} GLSL ES >= 1.00 - """)) + + [next section] + """.format(operator, gles))) test = shader_test.ShaderTest(six.text_type(p)) - assert os.path.basename(test.command[0]) == "shader_runner_gles2" + assert os.path.basename(test.command[0]) == expected def test_gles3_bin(self, tmpdir): """test.shader_test.ShaderTest: Identifies GLES3 tests successfully.""" |