tests: add frame_callback_wait_nofail
With expect_protocol_error, we need a possibility to wait for a frame
without aborting the test when wl_display_dispatch returns -1;
This patch adds function frame_callback_wait_nofail that only
returns 1 or 0 (instead of aborting on error).
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index 92cee9f..79097fa 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -80,12 +80,15 @@
return callback;
}
-void
-frame_callback_wait(struct client *client, int *done)
+int
+frame_callback_wait_nofail(struct client *client, int *done)
{
while (!*done) {
- assert(wl_display_dispatch(client->wl_display) >= 0);
+ if (wl_display_dispatch(client->wl_display) < 0)
+ return 0;
}
+
+ return 1;
}
void