[Piglit] [PATCH 8/8] tests/egl: report 'skip' instead of 'fail' if not running under X

Marek Olšák maraeo at gmail.com
Mon Apr 10 21:01:43 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 tests/egl/egl-configless-context.c                                   | 2 +-
 tests/egl/egl-util.c                                                 | 3 +--
 tests/egl/spec/egl_ext_client_extensions/egl_ext_client_extensions.c | 2 +-
 tests/egl/spec/egl_khr_create_context/common.c                       | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/egl/egl-configless-context.c b/tests/egl/egl-configless-context.c
index 154b55c..ce98465 100644
--- a/tests/egl/egl-configless-context.c
+++ b/tests/egl/egl-configless-context.c
@@ -333,21 +333,21 @@ int
 main(int argc, char **argv)
 {
 	static const EGLint config_attribs[] = {
 		EGL_NONE
 	};
 	struct state state;
 
 	state.dpy = XOpenDisplay(NULL);
 	if (state.dpy == NULL) {
 		fprintf(stderr, "couldn't open display\n");
-		piglit_report_result(PIGLIT_FAIL);
+		piglit_report_result(PIGLIT_SKIP);
 	}
 
 	eglBindAPI(EGL_OPENGL_API);
 
 	state.egl_dpy = eglGetDisplay(state.dpy);
 	if (state.egl_dpy == EGL_NO_DISPLAY) {
 		fprintf(stderr, "eglGetDisplay() failed\n");
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index 487d6e2..1676cc7 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -200,22 +200,21 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 	for (i = 1; i < argc; ++i) {
 		if (!strcmp(argv[i], "-auto"))
 			automatic = 1;
 		else
 			fprintf(stderr, "Unknown option: %s\n", argv[i]);
 	}
 
 	state.dpy = XOpenDisplay(NULL);
 	if (state.dpy == NULL) {
 		fprintf(stderr, "couldn't open display\n");
-		result = PIGLIT_FAIL;
-		goto fail;
+		piglit_report_result(PIGLIT_SKIP);
 	}
 
 	/* read api_bit if EGL_RENDERABLE_TYPE set in the attribs */
 	for (count = 0; test->config_attribs[count] != EGL_NONE; count += 2) {
 		if (test->config_attribs[count] == EGL_RENDERABLE_TYPE) {
 			api_bit = test->config_attribs[count+1];
 		}
 	}
 
 	/* bind chosen API and set ctxattribs if using ES */
diff --git a/tests/egl/spec/egl_ext_client_extensions/egl_ext_client_extensions.c b/tests/egl/spec/egl_ext_client_extensions/egl_ext_client_extensions.c
index abfe1a3..4ed9b43 100644
--- a/tests/egl/spec/egl_ext_client_extensions/egl_ext_client_extensions.c
+++ b/tests/egl/spec/egl_ext_client_extensions/egl_ext_client_extensions.c
@@ -145,21 +145,21 @@ test_3(void)
 	const char **client_ext_array;
 	int i, j;
 
 	dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 	if (!dpy) {
 		printf("Failed to get default display. Skipping.\n");
 		piglit_report_result(PIGLIT_SKIP);
 	}
 	if (!eglInitialize(dpy, &major_version, &minor_version)) {
 		printf("Failed to initialize default display\n");
-		piglit_report_result(PIGLIT_FAIL);
+		piglit_report_result(PIGLIT_SKIP);
 	}
 
 	display_ext_string = eglQueryString(dpy, EGL_EXTENSIONS);
 	if (!piglit_check_egl_error(EGL_SUCCESS)) {
 		printf("eglQueryString(EGL_EXTENSIONS) failed on default "
 		       "display\n");
 		piglit_report_result(PIGLIT_FAIL);
 	}
 	if (!display_ext_string) {
 		printf("eglQueryString(EGL_EXTENSIONS) returned null for "
diff --git a/tests/egl/spec/egl_khr_create_context/common.c b/tests/egl/spec/egl_khr_create_context/common.c
index bd02dc1..a443ced 100644
--- a/tests/egl/spec/egl_khr_create_context/common.c
+++ b/tests/egl/spec/egl_khr_create_context/common.c
@@ -85,21 +85,21 @@ EGL_KHR_create_context_setup(EGLint renderable_type_mask)
 		EGL_DEPTH_SIZE, 1,
 		EGL_RENDERABLE_TYPE, renderable_type_mask,
 		EGL_NONE
 	};
 	EGLint count;
 	EGLint major, minor;
 
 	dpy = XOpenDisplay(NULL);
 	if (dpy == NULL) {
 		fprintf(stderr, "couldn't open display\n");
-		piglit_report_result(PIGLIT_FAIL);
+		piglit_report_result(PIGLIT_SKIP);
 	}
 
 	egl_dpy = eglGetDisplay(dpy);
 	if (egl_dpy == EGL_NO_DISPLAY) {
 		fprintf(stderr, "eglGetDisplay() failed\n");
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
 	if (!eglInitialize(egl_dpy, &major, &minor)) {
 		fprintf(stderr, "eglInitialize() failed\n");
-- 
2.7.4



More information about the Piglit mailing list