diff options
| author | Manuel Stoeckl <code@mstoeckl.com> | 2019-08-18 12:36:14 -0400 |
|---|---|---|
| committer | Manuel Stoeckl <code@mstoeckl.com> | 2019-09-10 07:59:50 -0400 |
| commit | a89a5349af690f87c24abcaafc524f2cfd6e9d24 (patch) | |
| tree | e8701d68b0a22a64992342d002001e26dceb1caa /tests/test-compositor.c | |
| parent | client: Don't abort when sending a request fails (diff) | |
| download | wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar.gz wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar.bz2 wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar.lz wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar.xz wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.tar.zst wayland-a89a5349af690f87c24abcaafc524f2cfd6e9d24.zip | |
tests: Test that send overflow doesn't abort
The new display test runs a client that makes a very large number of
trivial requests. After responding to initial setup requests, the server
is paused, letting the trivial requests fill up the Unix socket buffer,
making further writes to the socket fail. The test then checks that the
client sets an appropriate error code, and does not abort or crash.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Diffstat (limited to 'tests/test-compositor.c')
| -rw-r--r-- | tests/test-compositor.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/test-compositor.c b/tests/test-compositor.c index 72f6351..bd2b015 100644 --- a/tests/test-compositor.c +++ b/tests/test-compositor.c @@ -45,7 +45,8 @@ struct test_compositor; static const struct wl_message tc_requests[] = { /* this request serves as a barrier for synchronizing*/ - { "stop_display", "u", NULL } + { "stop_display", "u", NULL }, + { "noop", "", NULL }, }; static const struct wl_message tc_events[] = { @@ -54,7 +55,7 @@ static const struct wl_message tc_events[] = { const struct wl_interface test_compositor_interface = { "test", 1, - 1, tc_requests, + 2, tc_requests, 1, tc_events }; @@ -62,6 +63,8 @@ struct test_compositor_interface { void (*stop_display)(struct wl_client *client, struct wl_resource *resource, uint32_t num); + void (*noop)(struct wl_client *client, + struct wl_resource *resource); }; struct test_compositor_listener { @@ -70,7 +73,8 @@ struct test_compositor_listener { }; enum { - STOP_DISPLAY = 0 + STOP_DISPLAY = 0, + TEST_NOOP = 1 }; enum { @@ -294,8 +298,16 @@ handle_stop_display(struct wl_client *client, wl_display_terminate(d->wl_display); } +static void +handle_noop(struct wl_client *client, struct wl_resource *resource) +{ + (void)client; + (void)resource; +} + static const struct test_compositor_interface tc_implementation = { - handle_stop_display + handle_stop_display, + handle_noop, }; static void @@ -509,3 +521,9 @@ stop_display(struct client *c, int num) return n; } + +void +noop_request(struct client *c) +{ + wl_proxy_marshal((struct wl_proxy *) c->tc, TEST_NOOP); +} |
