[Piglit] [PATCH] glx: Rerun failing tests in auto mode if there is a pending expose event

Thomas Hellstrom thellstrom at vmware.com
Tue Sep 26 16:32:40 UTC 2017


Tests that check frontbuffer contents after drawing may fail because
the X server touch the front contents between drawing and checking. In those
cases, there's typically a pending expose event. So check for that
situation and optionally rerun the test.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
 tests/util/piglit-glx-util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index 95e33ae..85f7eef 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;
-- 
2.7.4



More information about the Piglit mailing list