This adds some additional tests for ShaderTest behavior. Some of these tests fail because of dumb implementation details.
Signed-off-by: Dylan Baker <[email protected]> --- framework/tests/shader_test_tests.py | 57 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/framework/tests/shader_test_tests.py b/framework/tests/shader_test_tests.py index c0ec7d9..b254e89 100644 --- a/framework/tests/shader_test_tests.py +++ b/framework/tests/shader_test_tests.py @@ -18,12 +18,63 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""" Module with tests for shader_test """ +""" Provides tests for the shader_test module """ -from framework.shader_test import ShaderTest +import os +import nose.tools as nt +import framework.shader_test as shader_test +import framework.tests.utils as utils def test_initialize_shader_test(): """ Test that ShaderTest initializes """ - test = ShaderTest(['loopfunc.shader_test']) + test = shader_test.ShaderTest(['loopfunc.shader_test']) assert test + + [email protected](AssertionError) +def test_parse_gl_test_no_decimal(): + """ The GL Parser raises an exception if GL version lacks decimal """ + data = ('[require]\n' + 'GL = 2\n') + with utils.with_tempfile(data) as temp: + test = shader_test.ShaderTest([temp]) + + +def test_parse_gles2_test(): + """ Tests the parser for GLES2 tests """ + data = ('[require]\n' + 'GL ES >= 2.0\n' + 'GLSL ES >= 1.00\n') + with utils.with_tempfile(data) as temp: + test = shader_test.ShaderTest([temp]) + + nt.assert_equal( + os.path.basename(test.command[0]), "shader_runner_gles2", + msg="This test should have run with shader_runner_gles2, " + "but instead ran with " + os.path.basename(test.command[0])) + + +def test_parse_gles3_test(): + """ Tests the parser for GLES3 tests """ + data = ('[require]\n' + 'GL ES >= 3.0\n' + 'GLSL ES >= 3.00\n') + with utils.with_tempfile(data) as temp: + test = shader_test.ShaderTest([temp]) + + nt.assert_equal( + os.path.basename(test.command[0]), "shader_runner_gles3", + msg="This test should have run with shader_runner_gles3, " + "but instead ran with " + os.path.basename(test.command[0])) + + +def test_add_shader_test(): + """ Test that add_shader_test works """ + shader_test.add_shader_test( + {}, 'test', 'tests/spec/glsl-es-3.00/execution/sanity.shader_test') + + +def test_add_shader_test_dir(): + """ Test that add_shader_test_dir works """ + shader_test.add_shader_test_dir({}, 'tests/spec/glsl-es-3.00/execution') -- 1.9.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
