Commit dcbf2c2a authored by Peter Hutterer's avatar Peter Hutterer

test: don't leak test warnings to stdout

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent b5e3fd04
......@@ -180,6 +180,7 @@ START_TEST(log_axisrange_warning)
/* Expect only one message per 5 min */
ck_assert_int_eq(axisrange_log_handler_called, 1);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR);
litest_restore_log_handler(li);
axisrange_log_handler_called = 0;
}
......
......@@ -105,6 +105,7 @@ START_TEST(event_conversion_device_notify)
EV_KEY, BTN_LEFT,
-1, -1);
li = libinput_path_create_context(&simple_interface, NULL);
litest_restore_log_handler(li); /* use the default litest handler */
libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput));
libinput_dispatch(li);
......@@ -1202,16 +1203,6 @@ const struct libinput_interface leak_interface = {
.close_restricted = close_restricted_leak,
};
LIBINPUT_ATTRIBUTE_PRINTF(3, 0)
static void
simple_log_handler(struct libinput *libinput,
enum libinput_log_priority priority,
const char *format,
va_list args)
{
vfprintf(stderr, format, args);
}
START_TEST(fd_no_event_leak)
{
struct libevdev_uinput *uinput;
......@@ -1234,8 +1225,7 @@ START_TEST(fd_no_event_leak)
ck_assert_int_gt(fd, -1);
li = libinput_path_create_context(&leak_interface, &fd);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG);
libinput_log_set_handler(li, simple_log_handler);
litest_restore_log_handler(li); /* use the default litest handler */
/* Add the device, trigger an event, then remove it again.
* Without it, we get a SYN_DROPPED immediately and no events.
......
......@@ -86,12 +86,16 @@ START_TEST(path_create_invalid)
li = libinput_path_create_context(&simple_interface, NULL);
ck_assert(li != NULL);
litest_disable_log_handler(li);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
ck_assert_int_eq(open_func_count, 0);
ck_assert_int_eq(close_func_count, 0);
litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 0);
......@@ -111,12 +115,16 @@ START_TEST(path_create_invalid_kerneldev)
li = libinput_path_create_context(&simple_interface, NULL);
ck_assert(li != NULL);
litest_disable_log_handler(li);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
ck_assert_int_eq(open_func_count, 1);
ck_assert_int_eq(close_func_count, 1);
litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 1);
......@@ -143,6 +151,8 @@ START_TEST(path_create_invalid_file)
li = libinput_path_create_context(&simple_interface, NULL);
unlink(path);
litest_disable_log_handler(li);
ck_assert(li != NULL);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
......@@ -150,6 +160,7 @@ START_TEST(path_create_invalid_file)
ck_assert_int_eq(open_func_count, 0);
ck_assert_int_eq(close_func_count, 0);
litest_restore_log_handler(li);
libinput_unref(li);
ck_assert_int_eq(close_func_count, 0);
......@@ -175,6 +186,9 @@ START_TEST(path_create_destroy)
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
litest_disable_log_handler(li);
ck_assert(libinput_get_user_data(li) == userdata);
device = libinput_path_add_device(li,
......
......@@ -252,15 +252,15 @@ START_TEST(touch_double_touch_down_up)
dev = litest_current_device();
libinput = dev->libinput;
litest_disable_log_handler(libinput);
/* note: this test is a false negative, libevdev will filter
* tracking IDs re-used in the same slot. */
litest_touch_down(dev, 0, 0, 0);
litest_touch_down(dev, 0, 0, 0);
litest_touch_up(dev, 0);
litest_touch_up(dev, 0);
libinput_dispatch(libinput);
litest_restore_log_handler(libinput);
while ((ev = libinput_get_event(libinput))) {
switch (libinput_event_get_type(ev)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment