mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-04 01:30:20 +01:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
3b0f1d767a
commit
7e72c8e5bb
1 changed files with 13 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue