[Piglit] [PATCH 13/15] framework: New module shader_test.py
Chad Versace
chad.versace at linux.intel.com
Fri Dec 7 12:53:59 PST 2012
This patch is a small refactor. It moves add_shader_test_dir() from
all.tests into a new module, shader_test.py. Follow-on commits will expand
the role of the new module.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
framework/shader_test.py | 45 +++++++++++++++++++++++++++++++++++++++++++++
tests/all.tests | 18 +-----------------
2 files changed, 46 insertions(+), 17 deletions(-)
create mode 100644 framework/shader_test.py
diff --git a/framework/shader_test.py b/framework/shader_test.py
new file mode 100644
index 0000000..1a83545
--- /dev/null
+++ b/framework/shader_test.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# This permission notice shall be included in all copies or
+# substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+import os
+import os.path as path
+
+from exectest import PlainExecTest
+
+def add_shader_test_dir(group, dirpath, recursive=False):
+ """Add all shader tests in a directory to the given group."""
+ for filename in os.listdir(dirpath):
+ filepath = path.join(dirpath, filename)
+ if path.isdir(filepath):
+ if not recursive:
+ continue
+ if not filename in group:
+ group[filename] = Group()
+ add_shader_test_dir(group[filename], filepath, recursive)
+ else:
+ ext = filename.rsplit('.')[-1]
+ if ext != 'shader_test':
+ continue
+ testname = filename[0:-(len(ext) + 1)] # +1 for '.'
+ group[testname] = concurrent_test('shader_runner ' + filepath)
+
diff --git a/tests/all.tests b/tests/all.tests
index b35356e..c09e5ae 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -11,6 +11,7 @@ from framework.core import *
from framework.exectest import *
from framework.gleantest import *
from framework.glsl_parser_test import GLSLParserTest, add_glsl_parser_test, import_glsl_parser_tests
+from framework.shader_test import add_shader_test_dir
# Blacklisted tests are removed from the test profile.
blacklist = [
@@ -189,23 +190,6 @@ add_plain_test(security, 'initialized-vbo')
shaders = Group()
-def add_shader_test_dir(group, dirpath, recursive=False):
- """Add all shader tests in a directory to the given group."""
- for filename in os.listdir(dirpath):
- filepath = path.join(dirpath, filename)
- if path.isdir(filepath):
- if not recursive:
- continue
- if not filename in group:
- group[filename] = Group()
- add_shader_test_dir(group[filename], filepath, recursive)
- else:
- ext = filename.rsplit('.')[-1]
- if ext != 'shader_test':
- continue
- testname = filename[0:-(len(ext) + 1)] # +1 for '.'
- group[testname] = concurrent_test('shader_runner ' + filepath)
-
def add_getactiveuniform_count(group, name, expected):
path = 'shaders/'
group['glsl-getactiveuniform-count: ' + name] = PlainExecTest(['glsl-getactiveuniform-count',
--
1.7.11.7
More information about the Piglit
mailing list