Commit 7e72c8e5 authored by Peter Hutterer's avatar Peter Hutterer

test: always init the log_handler count and reset it last

When running with -j 1 and CK_FORK=no, the log_handler_count is shared between
the tests. The log_priority tests can invoke the log handler during
libinput_unref(), so on the next day the log handler starts with a nonzero log
handler.

Fix this by always initializing it to 0 in the tests we expect it to be zero
and resetting it last.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 3b0f1d76
......@@ -80,6 +80,9 @@ START_TEST(log_handler_invoked)
{
struct libinput *li;
log_handler_context = NULL;
log_handler_called = 0;
li = libinput_path_create_context(&simple_interface, NULL);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG);
......@@ -89,11 +92,11 @@ START_TEST(log_handler_invoked)
libinput_path_add_device(li, "/tmp");
ck_assert_int_gt(log_handler_called, 0);
log_handler_called = 0;
libinput_unref(li);
log_handler_context = NULL;
log_handler_called = 0;
}
END_TEST
......@@ -101,6 +104,8 @@ START_TEST(log_handler_NULL)
{
struct libinput *li;
log_handler_called = 0;
li = libinput_path_create_context(&simple_interface, NULL);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG);
libinput_log_set_handler(li, NULL);
......@@ -108,9 +113,10 @@ START_TEST(log_handler_NULL)
libinput_path_add_device(li, "/tmp");
ck_assert_int_eq(log_handler_called, 0);
log_handler_called = 0;
libinput_unref(li);
log_handler_called = 0;
}
END_TEST
......@@ -118,6 +124,9 @@ START_TEST(log_priority)
{
struct libinput *li;
log_handler_context = NULL;
log_handler_called = 0;
li = libinput_path_create_context(&simple_interface, NULL);
libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR);
libinput_log_set_handler(li, simple_log_handler);
......@@ -133,10 +142,10 @@ START_TEST(log_priority)
libinput_path_add_device(li, "/dev/input/event0");
ck_assert_int_gt(log_handler_called, 1);
log_handler_called = 0;
libinput_unref(li);
log_handler_context = NULL;
log_handler_called = 0;
}
END_TEST
......
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