[Piglit] [PATCH] egl_khr_create_context: Allow forward-compatible contexts to be rejected

Matt Turner mattst88 at gmail.com
Mon Aug 27 15:26:19 PDT 2012


This reworks the test to test whether
	1) forward-compatible contexts can be created, or
	2) the correct error is generated when they can't.

Previously the test did only the first and would fail if
forward-compatible contexts couldn't be created.
---
 .../valid-flag-forward-compatible-gl.c             |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
index 1bca548..4b6d6ba 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
@@ -20,6 +20,7 @@
  * IN THE SOFTWARE.
  */
 #include "piglit-util-gl-common.h"
+#include "piglit-util-egl.h"
 #include "common.h"
 
 int gl_version;
@@ -47,11 +48,19 @@ static bool try_flag(int flag)
 			gl_version = piglit_get_gl_version();
 		}
 		eglDestroyContext(egl_dpy, ctx);
-		return true;
+	} else {
+		fprintf(stderr, "Failed to create context with flag %d\n", flag);
+
+		/* The EGL_KHR_create_context spec says:
+		 *
+		 *     "* If an attribute name or attribute value in <attrib_list> is not
+		 *        recognized (including unrecognized bits in bitmask attributes),
+		 *        then an EGL_BAD_ATTRIBUTE error is generated."
+		 */
+		piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL);
 	}
 
-	fprintf(stderr, "Failed to create context with flag %d\n", flag);
-	return false;
+	return true;
 }
 
 int main(int argc, char **argv)
-- 
1.7.8.6



More information about the Piglit mailing list