[Piglit] [PATCH 5/6] generators: Replace outerProduct-invalid-paramters.sh with python

Dylan Baker baker.dylan.c at gmail.com
Fri May 9 13:21:44 PDT 2014


This Adds a new python generator to replace the shell generator. The old
generator was run once and the results were checked into git, the python
generator on the other hand is run at build time.

The tests are equivalent with only whitespace differences.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 generated_tests/CMakeLists.txt                     |  5 ++
 generated_tests/gen_outerproduct_invalid_params.py | 59 ++++++++++++++++++++++
 tests/all.py                                       |  3 ++
 .../built-in-functions/outerProduct-bool.vert      | 10 ----
 .../built-in-functions/outerProduct-bvec2.vert     | 10 ----
 .../built-in-functions/outerProduct-bvec3.vert     | 10 ----
 .../built-in-functions/outerProduct-bvec4.vert     | 10 ----
 .../built-in-functions/outerProduct-float.vert     | 10 ----
 .../built-in-functions/outerProduct-int.vert       | 10 ----
 .../outerProduct-invalid-parameters.sh             | 24 ---------
 .../built-in-functions/outerProduct-mat2.vert      | 10 ----
 .../built-in-functions/outerProduct-mat2x2.vert    | 10 ----
 .../built-in-functions/outerProduct-mat2x3.vert    | 10 ----
 .../built-in-functions/outerProduct-mat2x4.vert    | 10 ----
 .../built-in-functions/outerProduct-mat3.vert      | 10 ----
 .../built-in-functions/outerProduct-mat3x2.vert    | 10 ----
 .../built-in-functions/outerProduct-mat3x3.vert    | 10 ----
 .../built-in-functions/outerProduct-mat3x4.vert    | 10 ----
 .../built-in-functions/outerProduct-mat4.vert      | 10 ----
 .../built-in-functions/outerProduct-mat4x2.vert    | 10 ----
 .../built-in-functions/outerProduct-mat4x3.vert    | 10 ----
 .../built-in-functions/outerProduct-mat4x4.vert    | 10 ----
 22 files changed, 67 insertions(+), 204 deletions(-)
 create mode 100644 generated_tests/gen_outerproduct_invalid_params.py
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bool.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec2.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec3.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec4.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-float.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-int.vert
 delete mode 100755 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-invalid-parameters.sh
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x2.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x3.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x4.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x2.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x3.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x4.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x2.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x3.vert
 delete mode 100644 tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x4.vert

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 4079c28..fa7401b 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -72,11 +72,16 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
 	texture_lod_tests.list
 	gen_texture_lod_tests.py)
+piglit_make_generated_tests(
+	outerproduct_invalid_params.list
+	gen_outerproduct_invalid_params.py)
+
 
 # Add a "gen-tests" target that can be used to generate all the
 # tests without doing any other compilation.
 add_custom_target(gen-tests ALL
 	DEPENDS builtin_packing_tests.list
+		outerproduct_invalid_params.list
 		builtin_uniform_tests.list
 		constant_array_size_tests.list
 		builtin_cl_int_tests.list
diff --git a/generated_tests/gen_outerproduct_invalid_params.py b/generated_tests/gen_outerproduct_invalid_params.py
new file mode 100644
index 0000000..177b0eb
--- /dev/null
+++ b/generated_tests/gen_outerproduct_invalid_params.py
@@ -0,0 +1,59 @@
+# Copyright (c) 2014 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:
+
+# The above copyright notice and 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
+# AUTHORS OR COPYRIGHT HOLDERS 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.
+
+from __future__ import print_function
+import os
+import textwrap
+import mako.template
+
+
+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));
+    }
+    """))
+
+    try:
+        os.makedirs('spec/glsl-1.20/compiler/built-in-functions')
+    except OSError:
+        pass
+
+    for type_ in ['int', 'float', 'bool', 'bvec2', 'bvec3', 'bvec4', 'mat2',
+                  'mat2x2', 'mat2x3', 'mat2x4', 'mat3', 'mat3x2', 'mat3x3',
+                  'mat3x4', 'mat4', 'mat4x2', 'mat4x3', 'mat4x4']:
+        name = ('spec/glsl-1.20/compiler/built-in-functions/'
+                'outerProduct-{}.vert'.format(type_))
+        print(name)
+        with open(name, 'w+') as f:
+            f.write(template.render_unicode(type=type_))
+
+
+if __name__ == '__main__':
+    main()
diff --git a/tests/all.py b/tests/all.py
index ea5eadd..0ea2a77 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1183,6 +1183,9 @@ spec['glsl-1.20'] = {}
 import_glsl_parser_tests(spec['glsl-1.20'],
 			 os.path.join(testsDir, 'spec', 'glsl-1.20'),
 			 ['preprocessor', 'compiler'])
+import_glsl_parser_tests(spec['glsl-1.20'],
+			 os.path.join(testsDir, 'spec', 'glsl-1.20'),
+			 ['compiler'])
 spec['glsl-1.20']['execution'] = {}
 add_shader_test_dir(spec['glsl-1.20']['execution'],
 	            os.path.join(testsDir, 'spec', 'glsl-1.20', 'execution'),
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bool.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bool.vert
deleted file mode 100644
index 80d74e4..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bool.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(bool(0), bool(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec2.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec2.vert
deleted file mode 100644
index ce07f09..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec2.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(bvec2(0), bvec2(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec3.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec3.vert
deleted file mode 100644
index c55105e..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec3.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(bvec3(0), bvec3(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec4.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec4.vert
deleted file mode 100644
index 5e558e4..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec4.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(bvec4(0), bvec4(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-float.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-float.vert
deleted file mode 100644
index 171a544..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-float.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(float(0), float(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-int.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-int.vert
deleted file mode 100644
index 042e878..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-int.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(int(0), int(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-invalid-parameters.sh b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-invalid-parameters.sh
deleted file mode 100755
index 5f106eb..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-invalid-parameters.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-function emit_vs
-{
-    t=$1
-
-    cat > outerProduct-$t.vert <<EOF
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(${t}(0), ${t}(0));
-}
-EOF
-}
-
-for i in int float bool bvec2 bvec3 bvec4 mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4
-do
-    emit_vs $i
-done
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2.vert
deleted file mode 100644
index f35f29e..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat2(0), mat2(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x2.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x2.vert
deleted file mode 100644
index d6a7eeb..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x2.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat2x2(0), mat2x2(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x3.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x3.vert
deleted file mode 100644
index 10eb3d4..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x3.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat2x3(0), mat2x3(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x4.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x4.vert
deleted file mode 100644
index 503a021..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat2x4.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat2x4(0), mat2x4(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3.vert
deleted file mode 100644
index e634486..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat3(0), mat3(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x2.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x2.vert
deleted file mode 100644
index abe73da..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x2.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat3x2(0), mat3x2(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x3.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x3.vert
deleted file mode 100644
index ad62282..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x3.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat3x3(0), mat3x3(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x4.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x4.vert
deleted file mode 100644
index 8ee4983..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat3x4.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat3x4(0), mat3x4(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4.vert
deleted file mode 100644
index 93ed20e..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat4(0), mat4(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x2.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x2.vert
deleted file mode 100644
index 105e88e..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x2.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat4x2(0), mat4x2(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x3.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x3.vert
deleted file mode 100644
index c780542..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x3.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat4x3(0), mat4x3(0));
-}
diff --git a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x4.vert b/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x4.vert
deleted file mode 100644
index 94a7c52..0000000
--- a/tests/spec/glsl-1.20/compiler/built-in-functions/outerProduct-mat4x4.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.20
- * [end config]
- */
-#version 120
-void main () {
-  gl_Position = vec4(0);
-  outerProduct(mat4x4(0), mat4x4(0));
-}
-- 
2.0.0.rc2



More information about the Piglit mailing list