[Piglit] [PATCH 34/45] gen_outerproduct_invalid_params.py: Put template in templates dir

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


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/CMakeLists.txt                     |  4 +++-
 generated_tests/gen_outerproduct_invalid_params.py | 22 ++++++----------------
 .../template.vert.mako                             | 10 ++++++++++
 3 files changed, 19 insertions(+), 17 deletions(-)
 create mode 100644 generated_tests/templates/gen_outerproduct_invalid_params/template.vert.mako

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 1e6672e..55b718e 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -96,7 +96,9 @@ piglit_make_generated_tests(
 	)
 piglit_make_generated_tests(
 	outerproduct_invalid_params.list
-	gen_outerproduct_invalid_params.py)
+	gen_outerproduct_invalid_params.py
+	templates/gen_outerproduct_invalid_params/template.vert.mako
+	)
 piglit_make_generated_tests(
 	outerproduct_tests.list
 	gen_outerproduct_tests.py
diff --git a/generated_tests/gen_outerproduct_invalid_params.py b/generated_tests/gen_outerproduct_invalid_params.py
index 38e2d67..c872e9f 100644
--- a/generated_tests/gen_outerproduct_invalid_params.py
+++ b/generated_tests/gen_outerproduct_invalid_params.py
@@ -20,25 +20,15 @@
 
 from __future__ import print_function
 import os
-import textwrap
-import mako.template
+
+from templates import template_file
+
+TEMPLATE = template_file(os.path.basename(os.path.splitext(__file__)[0]),
+                         'template.vert.mako')
 
 
 def main():
     """ Generate tests """
-    template = mako.template.Template(textwrap.dedent("""
-    /* [config]
-     * expect_result: fail
-     * glsl_version: 1.20
-     * [end config]
-     */
-    #version 120
-    void main() {
-        gl_Position = vec4(0);
-        outerProduct(${type}(0), ${type}(0));
-    }
-    """))
-
     dirname = os.path.join('spec', 'glsl-1.20', 'compiler',
                            'built-in-functions')
     if not os.path.exists(dirname):
@@ -50,7 +40,7 @@ def main():
         name = os.path.join(dirname, 'outerProduct-{0}.vert'.format(type_))
         print(name)
         with open(name, 'w+') as f:
-            f.write(template.render_unicode(type=type_))
+            f.write(TEMPLATE.render_unicode(type=type_))
 
 
 if __name__ == '__main__':
diff --git a/generated_tests/templates/gen_outerproduct_invalid_params/template.vert.mako b/generated_tests/templates/gen_outerproduct_invalid_params/template.vert.mako
new file mode 100644
index 0000000..51eb2f0
--- /dev/null
+++ b/generated_tests/templates/gen_outerproduct_invalid_params/template.vert.mako
@@ -0,0 +1,10 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * [end config]
+ */
+#version 120
+void main() {
+    gl_Position = vec4(0);
+    outerProduct(${type}(0), ${type}(0));
+}
-- 
2.1.3



More information about the Piglit mailing list