[Piglit] [PATCH 02/45] gen_outerproduct_tests.py: Move template to templates dir

Dylan Baker baker.dylan.c at gmail.com
Wed Nov 12 15:45:44 PST 2014


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/CMakeLists.txt                              |  3 ++-
 generated_tests/gen_outerproduct_tests.py                   | 13 +++++++------
 .../gen_outerproduct_tests/template.shader_test.mako}       |  0
 3 files changed, 9 insertions(+), 7 deletions(-)
 rename generated_tests/{gen_outerproduct_template.mako => templates/gen_outerproduct_tests/template.shader_test.mako} (100%)

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 6d27b3e..33d9f42 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -81,7 +81,8 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
 	outerproduct_tests.list
 	gen_outerproduct_tests.py
-	gen_outerproduct_template.mako)
+	templates/gen_outerproduct_tests/template.shader_test.mako
+	)
 
 piglit_make_generated_tests(
 	builtin_uniform_tests_fp64.list
diff --git a/generated_tests/gen_outerproduct_tests.py b/generated_tests/gen_outerproduct_tests.py
index fdc3810..6211074 100644
--- a/generated_tests/gen_outerproduct_tests.py
+++ b/generated_tests/gen_outerproduct_tests.py
@@ -24,7 +24,11 @@ from __future__ import print_function
 import os
 import itertools
 import collections
-import mako.template
+
+from templates import template_file
+
+TEMPLATE = template_file(os.path.splitext(os.path.basename(__file__))[0],
+                         'template.shader_test.mako')
 
 Parameters = collections.namedtuple(
     'Paramters', ['columns', 'rows', 'vec_type', 'matrix'])
@@ -40,10 +44,6 @@ def main():
     name = ('spec/glsl-1.20/execution/'
             '{shader}-outerProduct-{type}{mat}{vec}.shader_test')
 
-    template = mako.template.Template(filename=
-        os.path.join(os.path.dirname(__file__),
-                     'gen_outerproduct_template.mako'))
-
     for c, r in itertools.product(xrange(2, 5), repeat=2):
         vecs = [
             Parameters(c, r, 'vec', 'mat{0}x{1}'.format(r, c)),
@@ -67,9 +67,10 @@ def main():
                     print(_name)
 
                     with open(_name, 'w+') as f:
-                        f.write(template.render_unicode(params=params,
+                        f.write(TEMPLATE.render_unicode(params=params,
                                                         type=type,
                                                         shader=shader))
 
+
 if __name__ == '__main__':
     main()
diff --git a/generated_tests/gen_outerproduct_template.mako b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
similarity index 100%
rename from generated_tests/gen_outerproduct_template.mako
rename to generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
-- 
2.1.3



More information about the Piglit mailing list