diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2011-01-07 15:07:18 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2011-01-07 15:41:56 -0800 |
commit | 8eca0f638ab4c67823b724837937bebc545dad86 (patch) | |
tree | adac9380f4134bd9a8a169e728b79a309f68d73b /framework | |
parent | affcf4bec52bcab570757b44e9001cde83b9c7d1 (diff) |
framework: Add utility function to import a directory tree of GLSL parser tests
Diffstat (limited to 'framework')
-rwxr-xr-x | framework/glsl_parser_test.py | 22 |
1 files changed, 22 insertions, 0 deletions
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. |