From 8eca0f638ab4c67823b724837937bebc545dad86 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 7 Jan 2011 15:07:18 -0800 Subject: framework: Add utility function to import a directory tree of GLSL parser tests --- framework/glsl_parser_test.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'framework') diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py index 7f91b2eb..93b52cd5 100755 --- a/framework/glsl_parser_test.py +++ b/framework/glsl_parser_test.py @@ -47,6 +47,28 @@ def add_glsl_parser_test(group, filepath, test_name): """Add an instance of GLSLParserTest to the given group.""" group[test_name] = GLSLParserTest(filepath) +def import_glsl_parser_tests(group, filepath, subdirectories): + # Register each shader source file in the directories below as + # a GLSLParserTest. + for d in subdirectories: + walk_dir = path.join(filepath, d) + for (dirpath, dirnames, filenames) in os.walk(walk_dir): + # Ignore dirnames. + for f in filenames: + # Add f as a test if its file extension is good. + ext = f.rsplit('.')[-1] + if ext in ['vert', 'geom', 'frag']: + filepath = path.join(dirpath, f) + # testname := filepath with initial + # 'tests/spec/glsl-1.30' removed + sep = os.sep + testname = sep.join(filepath.split(sep)[3:]) + assert(type(testname) is str) + add_glsl_parser_test( + group, + filepath, + testname) + class GLSLParserTest(PlainExecTest): """Test for the GLSL parser (and more) on a GLSL source file. -- cgit v1.2.3