[Piglit] [PATCH 3/4] gen_const_builtin_equal_tests: Make it possible to autogenerate tests.
Kenneth Graunke
kenneth at whitecape.org
Sat May 17 01:58:37 PDT 2014
This changes the (unused) generator to output to
generated_tests/spec/glsl-1.20/execution/built-in-functions
rather than the current directory. Also, make sure the destination
directory exists.
Since the tests won't live in tests/shaders, they can't refer to
glsl-mvp.vert by name. Just use gl_Position = gl_Vertex, since it's
a non-orthographic projection anyway.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
generated_tests/gen_const_builtin_equal_tests.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
Ths does change the VS in the tests slightly, but it's the right change,
and they pass before/after.
diff --git a/generated_tests/gen_const_builtin_equal_tests.py b/generated_tests/gen_const_builtin_equal_tests.py
index 2173e8e..4e5a4b4 100644
--- a/generated_tests/gen_const_builtin_equal_tests.py
+++ b/generated_tests/gen_const_builtin_equal_tests.py
@@ -1,5 +1,5 @@
import re
-
+import os
def emit_test(f, func, input1, input2, expected):
# Determine the expected return type of the equal function by looking at
@@ -12,8 +12,11 @@ def emit_test(f, func, input1, input2, expected):
[require]
GLSL >= 1.20
-[vertex shader file]
-glsl-mvp.vert
+[vertex shader]
+void main()
+{
+ gl_Position = gl_Vertex;
+}
[fragment shader]
void main()
@@ -79,9 +82,15 @@ test_vectors = [
]
]
+try:
+ os.makedirs('spec/glsl-1.20/execution/built-in-functions')
+except OSError:
+ pass
+
+
test_id = 2
for x in test_vectors:
- name = "glsl-const-builtin-%s-%02d.shader_test" % ("equal", test_id)
+ name = "spec/glsl-1.20/execution/built-in-functions/glsl-const-builtin-equal-%02d.shader_test" % test_id
test_id = test_id + 1
f = open(name, "w")
emit_test(f, "equal", x[0], x[1], x[2])
@@ -90,7 +99,7 @@ for x in test_vectors:
test_id = 2
for x in test_vectors:
- name = "glsl-const-builtin-%s-%02d.shader_test" % ("notEqual", test_id)
+ name = "spec/glsl-1.20/execution/built-in-functions/glsl-const-builtin-notEqual-%02d.shader_test" % test_id
test_id = test_id + 1
# When generating the notEqual tests, each of the values in the expected
--
1.9.2
More information about the Piglit
mailing list