summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-11-09 10:55:05 -0800
committerChad Versace <chad.versace@linux.intel.com>2012-11-14 08:31:53 -0800
commit8f977c305b56ffe5f8215ea545253a258a297023 (patch)
tree31dd5060a9ab2b7c634c8a71a3287b728b8021b3
parent2ff327a7afa418053e5f39bd416261e155ff05b4 (diff)
util/egl: Change piglit_expect_egl_error to return a bool
Previously, piglit_expect_egl_error() would terminate the test if an unexpected error occurred. However, there are many cases when we would prefer to simply report the error and continue testing. Commit 83c8ef80 made an analagous change to piglit_check_gl_error(). For consistency with that function, this commit also renames piglit_expect_egl_error to piglit_check_egl_error. In all cases, I replaced piglit_expect_egl_error(err, PIGLIT_FAIL) with if (!piglit_check_egl_error(err)) piglit_report_result(PIGLIT_FAIL) or some equivalent. Reviewed-by: Ian Romanick <idr@freedesktop.org> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--tests/egl/egl-query-surface.c15
-rw-r--r--tests/egl/spec/egl_khr_create_context/core-profile.c12
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-flag-gl.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-flag-gles.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-gl-version.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-profile.c3
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c4
-rw-r--r--tests/util/piglit-util-egl.c7
-rw-r--r--tests/util/piglit-util-egl.h7
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.