mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 02:20:13 +01:00
tests: bail on dispatch failure
Originally the test-asserts were abort()'ing. Then they were changed to record the failure but not abort() anymore. These loops were missed, accidentally turning them into endless loops on Wayland connection failure, e.g. a protocol error. When then loops become endless, they will repeatedly print the assertion failure message. When run as part of the test suite via Meson, Meson will collect all printouts in memory. Therefore the meson process will use memory rapidly without bounds. Break all these loops. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
4b61e44ad1
commit
015d73cb54
4 changed files with 14 additions and 7 deletions
|
|
@ -721,7 +721,8 @@ TEST_P(create_parametric_image_description, good_test_cases)
|
|||
image_desc_creator_param = NULL;
|
||||
|
||||
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
return RESULT_FAIL;
|
||||
test_assert_enum(image_desc->status, CM_IMAGE_DESC_READY);
|
||||
|
||||
image_description_destroy(image_desc);
|
||||
|
|
@ -837,7 +838,8 @@ TEST_P(fail_to_create_parametric_image_description, bad_test_cases)
|
|||
}
|
||||
|
||||
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
return RESULT_FAIL;
|
||||
|
||||
/* This TEST() is for bad params, so we shouldn't be able to
|
||||
* successfully create an image description. */
|
||||
|
|
|
|||
|
|
@ -784,7 +784,8 @@ wait_until_image_description_ready(struct client *client,
|
|||
struct image_description *image_descr)
|
||||
{
|
||||
while (image_descr->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
break;
|
||||
|
||||
test_assert_enum(image_descr->status, CM_IMAGE_DESC_READY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ TEST(simple_shot)
|
|||
|
||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||
while (!capt->events.reply)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
return RESULT_FAIL;
|
||||
|
||||
test_assert_enum(capt->state, CAPTURE_TASK_COMPLETE);
|
||||
|
||||
|
|
@ -292,7 +293,8 @@ TEST(retry_on_wrong_format)
|
|||
|
||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||
while (!capt->events.reply)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
return RESULT_FAIL;
|
||||
|
||||
test_assert_enum(capt->state, CAPTURE_TASK_RETRY);
|
||||
|
||||
|
|
@ -331,7 +333,8 @@ TEST(retry_on_wrong_size)
|
|||
|
||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||
while (!capt->events.reply)
|
||||
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(client->wl_display), 0))
|
||||
return RESULT_FAIL;
|
||||
|
||||
test_assert_enum(capt->state, CAPTURE_TASK_RETRY);
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ static void
|
|||
feedback_wait(struct feedback *fb)
|
||||
{
|
||||
while (fb->result == FB_PENDING) {
|
||||
test_assert_int_ge(wl_display_dispatch(fb->client->wl_display), 0);
|
||||
if (!test_assert_int_ge(wl_display_dispatch(fb->client->wl_display), 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue