[Piglit] [PATCH 07/12] arb_internalformat_query2: add common config macro for all query2 tests

Alejandro PiƱeiro apinheiro at igalia.com
Fri May 13 15:26:08 UTC 2016


As we are using the same source code in order to test this extension
on desktop gl, gles2 or gles3, the values of supports_gl_es_version or
supports_gl_compat_version can vary. Instead of using #ifdefs, one
alternative would be pass this value as a command line parameter
when calling the binary.

Acked-by: Eduardo Lima <elima at igalia.com>
Acked-by: Antia Puentes <apuentes at igalia.com>
---

Worth to note that the #ifdef solution was also used on other piglit
tests, like ARB_blend_func_extended.

 tests/spec/arb_internalformat_query2/api-errors.c  |  7 +----
 .../arb_internalformat_query2/color-encoding.c     |  7 +----
 tests/spec/arb_internalformat_query2/common.h      | 32 ++++++++++++++++++++++
 tests/spec/arb_internalformat_query2/filter.c      |  7 +----
 .../arb_internalformat_query2/format-components.c  |  7 +----
 .../generic-pname-checks.c                         |  7 +----
 .../image-format-compatibility-type.c              |  7 +----
 .../spec/arb_internalformat_query2/image-texture.c |  7 +----
 .../internalformat-size-checks.c                   |  7 +----
 .../internalformat-type-checks.c                   |  7 +----
 .../arb_internalformat_query2/max-dimensions.c     |  7 +----
 tests/spec/arb_internalformat_query2/minmax.c      |  7 +----
 .../arb_internalformat_query2/samples-pnames.c     |  7 +----
 .../texture-compressed-block.c                     |  7 +----
 14 files changed, 45 insertions(+), 78 deletions(-)

diff --git a/tests/spec/arb_internalformat_query2/api-errors.c b/tests/spec/arb_internalformat_query2/api-errors.c
index c66b221..1f76da1 100644
--- a/tests/spec/arb_internalformat_query2/api-errors.c
+++ b/tests/spec/arb_internalformat_query2/api-errors.c
@@ -42,12 +42,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-        config.supports_gl_compat_version = 10;
-        config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/color-encoding.c b/tests/spec/arb_internalformat_query2/color-encoding.c
index d38c7ed..ae0d763 100644
--- a/tests/spec/arb_internalformat_query2/color-encoding.c
+++ b/tests/spec/arb_internalformat_query2/color-encoding.c
@@ -28,12 +28,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/common.h b/tests/spec/arb_internalformat_query2/common.h
index df68581..935b9aa 100644
--- a/tests/spec/arb_internalformat_query2/common.h
+++ b/tests/spec/arb_internalformat_query2/common.h
@@ -23,6 +23,38 @@
 
 #include "piglit-util-gl.h"
 
+#ifdef PIGLIT_USE_OPENGL
+        #define QUERY2_CONFIG                                   \
+                PIGLIT_GL_TEST_CONFIG_BEGIN                     \
+                                                                \
+                config.supports_gl_compat_version = 20;         \
+                config.window_visual = PIGLIT_GL_VISUAL_RGB;    \
+                                                                \
+                PIGLIT_GL_TEST_CONFIG_END
+#endif
+
+#ifdef PIGLIT_USE_OPENGL_ES2
+        #define QUERY2_CONFIG                                   \
+                PIGLIT_GL_TEST_CONFIG_BEGIN                     \
+                                                                \
+                config.supports_gl_compat_version = 10;         \
+                config.supports_gl_es_version = 20;             \
+                config.window_visual = PIGLIT_GL_VISUAL_RGB;    \
+                                                                \
+                PIGLIT_GL_TEST_CONFIG_END
+#endif
+
+#ifdef PIGLIT_USE_OPENGL_ES3
+        #define QUERY2_CONFIG                                   \
+                PIGLIT_GL_TEST_CONFIG_BEGIN                     \
+                                                                \
+                config.supports_gl_compat_version = 10;         \
+                config.supports_gl_es_version = 30;             \
+                config.window_visual = PIGLIT_GL_VISUAL_RGB;    \
+                                                                \
+                PIGLIT_GL_TEST_CONFIG_END
+#endif
+
 static const GLenum valid_targets[] = {
         GL_TEXTURE_1D,
         GL_TEXTURE_1D_ARRAY,
diff --git a/tests/spec/arb_internalformat_query2/filter.c b/tests/spec/arb_internalformat_query2/filter.c
index 6d25b0e..1f815ea 100644
--- a/tests/spec/arb_internalformat_query2/filter.c
+++ b/tests/spec/arb_internalformat_query2/filter.c
@@ -47,12 +47,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/format-components.c b/tests/spec/arb_internalformat_query2/format-components.c
index bcd1c78..01aee39 100644
--- a/tests/spec/arb_internalformat_query2/format-components.c
+++ b/tests/spec/arb_internalformat_query2/format-components.c
@@ -35,12 +35,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-        config.supports_gl_compat_version = 10;
-        config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index 97f7d49..44b638e 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -36,12 +36,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 static const GLenum pnames_common_outcome[] = {
         GL_FRAMEBUFFER_RENDERABLE,
diff --git a/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
index b59084e..d351955 100644
--- a/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
+++ b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
@@ -30,12 +30,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/image-texture.c b/tests/spec/arb_internalformat_query2/image-texture.c
index f20d0aa..1fa7fce 100644
--- a/tests/spec/arb_internalformat_query2/image-texture.c
+++ b/tests/spec/arb_internalformat_query2/image-texture.c
@@ -35,12 +35,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
index 38cd440..2a43e7f 100644
--- a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
+++ b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
@@ -35,12 +35,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 static const GLenum pnames[] = {
         GL_INTERNALFORMAT_RED_SIZE,
diff --git a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
index 4b34215..4dc688c 100644
--- a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
+++ b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
@@ -34,12 +34,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 static const GLenum pnames[] = {
         GL_INTERNALFORMAT_RED_TYPE,
diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c b/tests/spec/arb_internalformat_query2/max-dimensions.c
index 7721c4e..a80fb9b 100644
--- a/tests/spec/arb_internalformat_query2/max-dimensions.c
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -82,12 +82,7 @@
 #include <inttypes.h>  /* for PRIu64 macro */
 #include <limits.h> /* For INT_MAX */
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
diff --git a/tests/spec/arb_internalformat_query2/minmax.c b/tests/spec/arb_internalformat_query2/minmax.c
index 2bbb202..f235fbb 100644
--- a/tests/spec/arb_internalformat_query2/minmax.c
+++ b/tests/spec/arb_internalformat_query2/minmax.c
@@ -36,12 +36,7 @@
         fprintf(stderr, "64 bit query: ") : \
         fprintf(stderr, "32 bit query: ");
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-        config.supports_gl_compat_version = 10;
-        config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 /* These are all the formats that are required to be color-renderable
  * by the OpenGL 3.0 spec.
diff --git a/tests/spec/arb_internalformat_query2/samples-pnames.c b/tests/spec/arb_internalformat_query2/samples-pnames.c
index afa53ec..cd2d4ab 100644
--- a/tests/spec/arb_internalformat_query2/samples-pnames.c
+++ b/tests/spec/arb_internalformat_query2/samples-pnames.c
@@ -31,12 +31,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 static const GLenum without_multisample_targets[] = {
         GL_TEXTURE_1D,
diff --git a/tests/spec/arb_internalformat_query2/texture-compressed-block.c b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
index 3bc4f95..c0f7133 100644
--- a/tests/spec/arb_internalformat_query2/texture-compressed-block.c
+++ b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
@@ -48,12 +48,7 @@
 
 #include "common.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-	config.window_visual = PIGLIT_GL_VISUAL_RGB;
-
-PIGLIT_GL_TEST_CONFIG_END
+QUERY2_CONFIG
 
 enum piglit_result
 piglit_display(void)
-- 
2.7.4



More information about the Piglit mailing list