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>
This commit is contained in:
Manuel Stoeckl 2019-08-18 12:36:14 -04:00
parent 8a831ac6ec
commit a89a5349af
3 changed files with 88 additions and 4 deletions

View file

@ -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);
}