diff options
11 files changed, 39 insertions, 24 deletions
diff --git a/tests/egl/egl-query-surface.c b/tests/egl/egl-query-surface.c index c61ab5e6..d6424e4d 100644 --- a/tests/egl/egl-query-surface.c +++ b/tests/egl/egl-query-surface.c @@ -64,7 +64,9 @@ query_width(struct egl_state *state) assert(state->width == window_width); ok = eglQuerySurface(state->egl_dpy, state->surf, EGL_WIDTH, &width); - piglit_expect_egl_error(EGL_SUCCESS, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_SUCCESS)) { + piglit_report_result(PIGLIT_FAIL); + } if (!ok) { fprintf(stderr, "error: eglQuerySurface() failed\n"); return PIGLIT_FAIL; @@ -86,7 +88,9 @@ query_height(struct egl_state *state) assert(state->height == window_height); ok = eglQuerySurface(state->egl_dpy, state->surf, EGL_HEIGHT, &height); - piglit_expect_egl_error(EGL_SUCCESS, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_SUCCESS)) { + piglit_report_result(PIGLIT_FAIL); + } if (!ok) { fprintf(stderr, "error: eglQuerySurface() failed\n"); return PIGLIT_FAIL; @@ -112,7 +116,9 @@ query_bad_surface(struct egl_state *state) "error: eglQuerySurface(surface=0) succeeded\n"); return PIGLIT_FAIL; } - piglit_expect_egl_error(EGL_BAD_SURFACE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_SURFACE)) { + piglit_report_result(PIGLIT_FAIL); + } return PIGLIT_PASS; } @@ -130,7 +136,8 @@ query_bad_parameter(struct egl_state *state) "succeeded\n"); return PIGLIT_FAIL; } - piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) + piglit_report_result(PIGLIT_FAIL); return PIGLIT_PASS; } diff --git a/tests/egl/spec/egl_khr_create_context/core-profile.c b/tests/egl/spec/egl_khr_create_context/core-profile.c index c63993a1..85f4d2aa 100644 --- a/tests/egl/spec/egl_khr_create_context/core-profile.c +++ b/tests/egl/spec/egl_khr_create_context/core-profile.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) if (ctx != EGL_NO_CONTEXT) { eglDestroyContext(egl_dpy, ctx); got_core_with_profile = true; - } else { + } else if (!piglit_check_egl_error(EGL_BAD_MATCH)) { /* The EGL_KHR_create_context spec says: * * "* If <config> does not support a client API context @@ -84,7 +84,7 @@ int main(int argc, char **argv) * are supported), then an EGL_BAD_MATCH error is * generated." */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + piglit_report_result(PIGLIT_FAIL); } /* The EGL_KHR_create_context spec says: @@ -97,7 +97,7 @@ int main(int argc, char **argv) if (ctx != EGL_NO_CONTEXT) { eglDestroyContext(egl_dpy, ctx); got_core_without_profile = true; - } else { + } else if (!piglit_check_egl_error(EGL_BAD_MATCH)) { /* The EGL_KHR_create_context spec says: * * "* If <config> does not support a client API context @@ -107,7 +107,7 @@ int main(int argc, char **argv) * are supported), then an EGL_BAD_MATCH error is * generated." */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + piglit_report_result(PIGLIT_FAIL); } ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, compatibility_attribs); @@ -115,7 +115,7 @@ int main(int argc, char **argv) if (ctx != EGL_NO_CONTEXT) { eglDestroyContext(egl_dpy, ctx); got_compatibility = true; - } else { + } else if (!piglit_check_egl_error(EGL_BAD_MATCH)) { /* The EGL_KHR_create_context spec says: * * "* If <config> does not support a client API context @@ -125,7 +125,7 @@ int main(int argc, char **argv) * are supported), then an EGL_BAD_MATCH error is * generated." */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + piglit_report_result(PIGLIT_FAIL); } EGL_KHR_create_context_teardown(); diff --git a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c index b99dee8c..d1c99ab0 100644 --- a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c +++ b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c @@ -47,7 +47,8 @@ static bool try_attribute(int attribute) * recognized (including unrecognized bits in bitmask attributes), * then an EGL_BAD_ATTRIBUTE error is generated." */ - piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) + piglit_report_result(PIGLIT_FAIL); return pass; } diff --git a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c index d3e030ce..0ee24dea 100644 --- a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c +++ b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c @@ -56,7 +56,8 @@ static bool try_attribute(int attribute) * recognized (including unrecognized bits in bitmask attributes), * then an EGL_BAD_ATTRIBUTE error is generated." */ - piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) + piglit_report_result(PIGLIT_FAIL); return pass; } diff --git a/tests/egl/spec/egl_khr_create_context/invalid-flag-gl.c b/tests/egl/spec/egl_khr_create_context/invalid-flag-gl.c index 1aac646d..ce4fe2d0 100644 --- a/tests/egl/spec/egl_khr_create_context/invalid-flag-gl.c +++ b/tests/egl/spec/egl_khr_create_context/invalid-flag-gl.c @@ -47,7 +47,8 @@ static bool try_flag(uint32_t flag) * recognized (including unrecognized bits in bitmask attributes), * then an EGL_BAD_ATTRIBUTE error is generated." */ - piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) + piglit_report_result(PIGLIT_FAIL); return pass; } diff --git a/tests/egl/spec/egl_khr_create_context/invalid-flag-gles.c b/tests/egl/spec/egl_khr_create_context/invalid-flag-gles.c index 3618a918..b12db204 100644 --- a/tests/egl/spec/egl_khr_create_context/invalid-flag-gles.c +++ b/tests/egl/spec/egl_khr_create_context/invalid-flag-gles.c @@ -47,7 +47,8 @@ static bool try_flag(uint32_t flag) * recognized (including unrecognized bits in bitmask attributes), * then an EGL_BAD_ATTRIBUTE error is generated." */ - piglit_expect_egl_error(EGL_BAD_ATTRIBUTE, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) + piglit_report_result(PIGLIT_FAIL); return pass; } 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 ee33fb92..680b70b0 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 @@ -50,7 +50,8 @@ static bool try_version(int major, int minor) * version and feature set that are not defined, than an * EGL_BAD_MATCH error is generated." */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_MATCH)) + piglit_report_result(PIGLIT_FAIL); return pass; } diff --git a/tests/egl/spec/egl_khr_create_context/invalid-profile.c b/tests/egl/spec/egl_khr_create_context/invalid-profile.c index d7aece89..fe4f4293 100644 --- a/tests/egl/spec/egl_khr_create_context/invalid-profile.c +++ b/tests/egl/spec/egl_khr_create_context/invalid-profile.c @@ -59,7 +59,8 @@ static bool try_profile(int profile) * support the requested profile, then an EGL_BAD_MATCH error is * generated." */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + if (!piglit_check_egl_error(EGL_BAD_MATCH)) + piglit_report_result(PIGLIT_FAIL); return pass; } 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 b41fda0b..2f2c0a71 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 @@ -48,7 +48,7 @@ static bool try_flag(int flag) gl_version = piglit_get_gl_version(); } eglDestroyContext(egl_dpy, ctx); - } else { + } else if (!piglit_check_egl_error(EGL_BAD_MATCH)) { /* The EGL_KHR_create_context spec says: * * "* If <config> does not support a client API context compatible @@ -57,7 +57,7 @@ static bool try_flag(int flag) * where these attributes are supported), then an EGL_BAD_MATCH * error is generated. */ - piglit_expect_egl_error(EGL_BAD_MATCH, PIGLIT_FAIL); + piglit_report_result(PIGLIT_FAIL); } return true; diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c index a7d37e56..1087429f 100644 --- a/tests/util/piglit-util-egl.c +++ b/tests/util/piglit-util-egl.c @@ -48,13 +48,14 @@ const char* piglit_get_egl_error_name(EGLint error) { #undef CASE } -void piglit_expect_egl_error(EGLint expected_error, enum piglit_result result) +bool +piglit_check_egl_error(EGLint expected_error) { EGLint actual_error; actual_error = eglGetError(); if (actual_error == expected_error) { - return; + return true; } /* @@ -72,7 +73,7 @@ void piglit_expect_egl_error(EGLint expected_error, enum piglit_result result) piglit_get_egl_error_name(expected_error), expected_error); } - piglit_report_result(result); + return false; } bool diff --git a/tests/util/piglit-util-egl.h b/tests/util/piglit-util-egl.h index db94eeb3..7faccf49 100644 --- a/tests/util/piglit-util-egl.h +++ b/tests/util/piglit-util-egl.h @@ -41,14 +41,15 @@ extern "C" { const char* piglit_get_egl_error_name(EGLint error); /** - * \brief Check for unexpected EGL errors and possibly terminate the test. + * \brief Check for unexpected EGL errors. * * If eglGetError() returns an error other than \c expected_error, then - * print a diagnostic and terminate the test with the given result. + * print a diagnostic and return false. * * If you expect no error, then set \code expected_error = EGL_SUCCESS \endcode. */ -void piglit_expect_egl_error(EGLint expected_error, enum piglit_result result); +bool +piglit_check_egl_error(EGLint expected_error); /** * \brief Checks whether an EGL extension is supported. |