[Piglit] [patch v3 01/15] glsl_parser_test_tests.py: Add tests for command

Dylan Baker baker.dylan.c at gmail.com
Mon Jul 28 17:34:11 PDT 2014


These tests conform that the value of command is what is expected based
on the value of the config block.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/tests/glsl_parser_test_tests.py | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 5e083b8..8d521d2 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -144,3 +144,38 @@ def test_blank_in_config():
 def test_glslparser_initializer():
     """ GLSLParserTest initializes """
     glsl.GLSLParserTest('tests/spec/glsl-es-1.00/compiler/version-macro.frag')
+
+
+def check_config_to_command(config, result):
+    """ Check that the config is correctly converted """
+    inst, f = _check_config(config)
+    result.insert(1, f)  # Add the file name
+
+    nt.eq_(inst.command, result)
+
+
+ at utils.nose_generator
+def test_config_to_command():
+    """ Generate tests that confirm the config file is correctly parsed """
+    content = [
+        ('// [config]\n// expect_result: pass\n// glsl_version: 1.00\n// [end config]\n',
+         [os.path.join(TEST_BIN_DIR, 'glslparsertest'), 'pass', '1.00'],
+         'all required options'),
+        ('// [config]\n// expect_result: pass\n// glsl_version: 1.00\n//check_link: true\n// [end config]\n',
+         [os.path.join(TEST_BIN_DIR, 'glslparsertest'), 'pass', '1.00', '--check-link'],
+         'check_link true'),
+        ('// [config]\n// expect_result: pass\n// glsl_version: 1.00\n//check_link: false\n// [end config]\n',
+         [os.path.join(TEST_BIN_DIR, 'glslparsertest'), 'pass', '1.00'],
+         'check_link false'),
+        ('// [config]\n// expect_result: pass\n// glsl_version: 1.00\n//require_extensions: ARB_foo\n// [end config]\n',
+         [os.path.join(TEST_BIN_DIR, 'glslparsertest'), 'pass', '1.00', 'ARB_foo'],
+         'one required_extension'),
+        ('// [config]\n// expect_result: pass\n// glsl_version: 1.00\n//require_extensions: ARB_foo ARB_bar\n// [end config]\n',
+         [os.path.join(TEST_BIN_DIR, 'glslparsertest'), 'pass', '1.00', 'ARB_foo', 'ARB_bar'],
+         'multiple required_extensions'),
+    ]
+
+    for config, result, desc in content:
+        check_config_to_command.description = \
+            'Command correctly generated for {}'.format(desc)
+        yield check_config_to_command, config, result
-- 
2.0.2



More information about the Piglit mailing list