[Piglit] [PATCH 1/3] glsl_parser_test.py: Don't allow , or ; between require_extensions
Dylan Baker
baker.dylan.c at gmail.com
Tue Jun 24 16:54:15 PDT 2014
This is not a valid input, require_extensions is a space delimited list
of extensions, raise a exception if these are requested.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/glsl_parser_test.py | 7 +++++-
framework/tests/glsl_parser_test_tests.py | 36 +++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 27fd2ca..52b87f1 100644
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -152,7 +152,12 @@ class GLSLParserTest(PiglitTest):
config.get('config', 'glsl_version')]
if config.get('config', 'check_link').lower() == 'true':
command.append('--check-link')
- command.extend(config.get('config', 'require_extensions').split())
+ required = config.get('config', 'require_extensions').split()
+ for x in required:
+ if x[-1] in [';', ',']:
+ raise GLSLParserException('require_extensions cannot be '
+ 'seperated with "," or ";"')
+ command.extend(required)
super(GLSLParserTest, self).__init__(command, run_concurrent=True)
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 5e083b8..9794331 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -144,3 +144,39 @@ def test_blank_in_config():
def test_glslparser_initializer():
""" GLSLParserTest initializes """
glsl.GLSLParserTest('tests/spec/glsl-es-1.00/compiler/version-macro.frag')
+
+
+def test_glslparser_require_trailing_comma():
+ """ GLSLParserTest() asserts if ',' are used on extensions """
+ content = ('// [config]\n'
+ '// expect_result: pass\n'
+ '// glsl_version: 1.00\n'
+ '// require_extensions: ARB_ham_sandwhich, ARB_pb&j\n'
+ '// [end config]\n')
+
+ with utils.with_tempfile(content) as tfile:
+ with nt.assert_raises(glsl.GLSLParserException) as exc:
+ glsl.GLSLParserTest(tfile)
+ nt.assert_equal(
+ exc.exception,
+ 'require_extensions cannot be seperated with "," or ";"',
+ msg=("Exception not raised if ',' used to seperate"
+ "require_extensions"))
+
+
+def test_glslparser_require_trailing_semicolon():
+ """ GLSLParserTest() asserts if ';' are used on extensions """
+ content = ('// [config]\n'
+ '// expect_result: pass\n'
+ '// glsl_version: 1.00\n'
+ '// require_extensions: ARB_ham_sandwhich; ARB_pb&j\n'
+ '// [end config]\n')
+
+ with utils.with_tempfile(content) as tfile:
+ with nt.assert_raises(glsl.GLSLParserException) as exc:
+ glsl.GLSLParserTest(tfile)
+ nt.assert_equal(
+ exc.exception,
+ 'require_extensions cannot be seperated with "," or ";"',
+ msg=("Exception not raised if ';' used to seperate"
+ "require_extensions"))
--
2.0.0
More information about the Piglit
mailing list