[Piglit] [PATCH 1/2] egl-create-context-invalid-version: Improve error messages

Chad Versace chad.versace at linux.intel.com
Thu Nov 8 11:00:29 PST 2012


If context creation succeeds, the error message stated the context
version but not the api currently being tested.

CC: Ian Romanick <idr at freedesktop.org>
CC: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/egl/spec/egl_khr_create_context/invalid-gl-version.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/egl/spec/egl_khr_create_context/invalid-gl-version.c b/tests/egl/spec/egl_khr_create_context/invalid-gl-version.c
index ee33fb9..9bbce5c 100644
--- a/tests/egl/spec/egl_khr_create_context/invalid-gl-version.c
+++ b/tests/egl/spec/egl_khr_create_context/invalid-gl-version.c
@@ -23,6 +23,8 @@
 #include "piglit-util-egl.h"
 #include "common.h"
 
+static const char *api_name = NULL;
+
 static bool try_version(int major, int minor)
 {
 	const EGLint attribs[] = {
@@ -35,8 +37,8 @@ static bool try_version(int major, int minor)
 	ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
 	if (ctx != NULL) {
 		fprintf(stderr,
-			"Created OpenGL context with invalid version %d.%d\n",
-			major, minor);
+			"Created %s context with invalid version %d.%d\n",
+			api_name, major, minor);
 		eglDestroyContext(egl_dpy, ctx);
 		pass = false;
 	}
@@ -77,6 +79,7 @@ int main(int argc, char **argv)
 	 *       - Forward-compatible flag set and major version < 3
 	 */
 	if (EGL_KHR_create_context_setup(EGL_OPENGL_ES_BIT)) {
+		api_name = "OpenGL ES1";
 		ran_test = true;
 		pass = pass && try_version(-1, 0);
 		pass = pass && try_version(0, 0);
@@ -86,6 +89,7 @@ int main(int argc, char **argv)
 		EGL_KHR_create_context_teardown();
 	}
 	if (EGL_KHR_create_context_setup(EGL_OPENGL_ES2_BIT)) {
+		api_name = "OpenGL ES2";
 		ran_test = true;
 		pass = pass && try_version(2, -1);
 		pass = pass && try_version(2, 1);
@@ -93,6 +97,7 @@ int main(int argc, char **argv)
 		EGL_KHR_create_context_teardown();
 	}
 	if (EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
+		api_name = "OpenGL";
 		ran_test = true;
 		eglBindAPI(EGL_OPENGL_API);
 		pass = pass && try_version(-1, 0);
-- 
1.7.11.7



More information about the Piglit mailing list