summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-06-01 15:00:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-06-02 10:53:50 +1000
commitdcbf2c2a44fb04c6001f3bb61714659c0d1f48f4 (patch)
treea5b7b795c16f9e510ca35eead3d8585363ecc405
parentb5e3fd04b2ab667e844e34082f8af9b277728774 (diff)
test: don't leak test warnings to stdout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--test/test-log.c1
-rw-r--r--test/test-misc.c14
-rw-r--r--test/test-path.c14
-rw-r--r--test/test-touch.c4
4 files changed, 19 insertions, 14 deletions
diff --git a/test/test-log.c b/test/test-log.c
index 9988267..c07e6bd 100644
--- a/test/test-log.c
+++ b/test/test-log.c
@@ -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;
}
diff --git a/test/test-misc.c b/test/test-misc.c
index 5101dcf..e55daed 100644
--- a/test/test-misc.c
+++ b/test/test-misc.c
@@ -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.
diff --git a/test/test-path.c b/test/test-path.c
index 4f49d2b..16b4daa 100644
--- a/test/test-path.c
+++ b/test/test-path.c
@@ -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,
diff --git a/test/test-touch.c b/test/test-touch.c
index a7dc411..c9f78d1 100644
--- a/test/test-touch.c
+++ b/test/test-touch.c
@@ -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)) {