[PATCH wayland v2 8/8] tests: Test that one can fetch the protocol error after EPIPE

Daniel Stone daniel at fooishbar.org
Tue Dec 29 03:15:38 PST 2015


Hi Jonas,

On 29 December 2015 at 02:10, Jonas Ã…dahl <jadahl at gmail.com> wrote:
> +       /* The server will not actually destroy the client until it receives
> +        * input, so send something to trigger the client destruction. */
> +       callback = wl_display_sync(client->wl_display);
> +       wl_callback_destroy(callback);
> +
> +       /* Sleep some to give the server a chance to react and destroy the
> +        * client. */
> +       test_usleep(200000);

I don't really love the forced 200ms wait here; I'd prefer to do a
kernel-style early exit from time-bounded wait, e.g.:
timeout = now() + MS(200);
while (now() < timeout)
    check_for_error_using_*(); /* will block until error arrives */
while (now() < timeout) {
    if (wl_display_dispatch() == 0) {
        msleep(10);
        continue; /* fd still alive; give server time to kill it */
    }
    assert(errno == EPIPE);
}

Aside from this and my comment on the roundtrip rewrite, for the series:
Reviewed-by: Daniel Stone <daniels at collabora.com>

Cheers,
Daniel


More information about the wayland-devel mailing list