[Piglit] [PATCH 1/4] glsl: Rewrite version-macro tests to ensure they're #defines.

Kenneth Graunke kenneth at whitecape.org
Wed Aug 28 12:43:32 PDT 2013


The old tests verified that the value of __VERSION__ was correct, but
didn't verify that __VERSION__ is an actual #define, as opposed to a
built-in integer constant variable.

The new approach checks both.

Suggested-by: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 tests/spec/glsl-1.50/compiler/version-macro.frag | 9 ++++++++-
 tests/spec/glsl-3.30/compiler/version-macro.frag | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/tests/spec/glsl-1.50/compiler/version-macro.frag b/tests/spec/glsl-1.50/compiler/version-macro.frag
index 735ffc8..532d129 100644
--- a/tests/spec/glsl-1.50/compiler/version-macro.frag
+++ b/tests/spec/glsl-1.50/compiler/version-macro.frag
@@ -4,4 +4,11 @@
 // [end config]
 
 #version 150
-int x[int(__VERSION__ == 150)];
+#if !defined __VERSION__
+#error __VERSION__ not defined.
+#endif
+#if __VERSION__ != 150
+#error __VERSION__ is not 150
+#endif
+
+void main() { }
diff --git a/tests/spec/glsl-3.30/compiler/version-macro.frag b/tests/spec/glsl-3.30/compiler/version-macro.frag
index d4107ce..20b7815 100644
--- a/tests/spec/glsl-3.30/compiler/version-macro.frag
+++ b/tests/spec/glsl-3.30/compiler/version-macro.frag
@@ -4,4 +4,11 @@
 // [end config]
 
 #version 330
-int x[int(__VERSION__ == 330)];
+#if !defined __VERSION__
+#error __VERSION__ not defined.
+#endif
+#if __VERSION__ != 330
+#error __VERSION__ is not 330
+#endif
+
+void main() { }
-- 
1.8.3.4



More information about the Piglit mailing list