summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-09-26 18:28:56 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2017-10-12 20:05:46 +0200
commit28a77cb84dcec49b55c82663615f052efee2bc67 (patch)
tree67ac3ffbc2a2569f6b1c55518ea72ac36f80dbf7
parentb7b93113e0b274efa8dd79a14e8acbe7054fcb84 (diff)
glx: Rerun failing tests in auto mode if there is a pending expose event
Tests that check frontbuffer contents after drawing may fail because the X server touch the front contents between drawing and reading. In those cases, there's typically a pending expose event. So check for that situation and rerun the test. This fixes sporadic failures with glx-swap-copy when run with a compositor and a swap-interval of zero. It would also have fixed gl-1.0@swapbuffers-behavior, but a workaround (at least for dri3) was pushed in "df56af2b" (gl-1.0/swapbuffers-behavior: Try avoid reading from real front v2), but that test-specific workaround could be reverted after this commit. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt: <eric@anholt.net>
-rw-r--r--tests/util/piglit-glx-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 95e33aed9..85f7eef5f 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -212,6 +212,20 @@ piglit_glx_event_loop(Display *dpy, enum piglit_result (*draw)(Display *dpy))
enum piglit_result result = draw(dpy);
if (piglit_automatic) {
+ /*
+ * Rerun if we have failed and have a
+ * pending expose event, which might be an
+ * indication of invalid front buffer
+ * contents.
+ */
+ if (result == PIGLIT_FAIL &&
+ XCheckTypedEvent(dpy, Expose, &event)) {
+ fprintf(stderr,
+ "Pending expose event- "
+ "rerunning.\n");
+ XPutBackEvent(dpy, &event);
+ continue;
+ }
XCloseDisplay(dpy);
piglit_report_result(result);
break;