Commit 9b18adc4 authored by Peter Hutterer's avatar Peter Hutterer

test: replace != NULL checks with ck_assert_notnull

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 1228fab8
Pipeline #19640 failed with stages
in 24 minutes and 23 seconds
......@@ -1174,7 +1174,7 @@ START_TEST(device_nonpointer_rel)
li = litest_create_context();
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
litest_disable_log_handler(li);
for (i = 0; i < 100; i++) {
......@@ -1216,7 +1216,7 @@ START_TEST(device_touchpad_rel)
li = litest_create_context();
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
for (i = 0; i < 100; i++) {
libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
......@@ -1255,7 +1255,7 @@ START_TEST(device_touch_rel)
li = litest_create_context();
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
litest_disable_log_handler(li);
for (i = 0; i < 100; i++) {
......@@ -1293,7 +1293,7 @@ START_TEST(device_abs_rel)
li = litest_create_context();
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
for (i = 0; i < 100; i++) {
libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
......
......@@ -94,7 +94,7 @@ START_TEST(path_create_NULL)
li = libinput_path_create_context(NULL, NULL);
ck_assert(li == NULL);
li = libinput_path_create_context(&counting_interface, &counter);
ck_assert(li != NULL);
ck_assert_notnull(li);
libinput_unref(li);
ck_assert_int_eq(counter.open_func_count, 0);
......@@ -113,7 +113,7 @@ START_TEST(path_create_invalid)
counter.close_func_count = 0;
li = libinput_path_create_context(&counting_interface, &counter);
ck_assert(li != NULL);
ck_assert_notnull(li);
litest_disable_log_handler(li);
......@@ -140,7 +140,7 @@ START_TEST(path_create_invalid_kerneldev)
counter.close_func_count = 0;
li = libinput_path_create_context(&counting_interface, &counter);
ck_assert(li != NULL);
ck_assert_notnull(li);
litest_disable_log_handler(li);
......@@ -177,7 +177,7 @@ START_TEST(path_create_invalid_file)
litest_disable_log_handler(li);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
......@@ -206,7 +206,7 @@ START_TEST(path_create_pathmax_file)
li = libinput_path_create_context(&counting_interface, &counter);
litest_set_log_handler_bug(li);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li, path);
ck_assert(device == NULL);
......@@ -240,7 +240,7 @@ START_TEST(path_create_destroy)
-1);
li = libinput_path_create_context(&counting_interface, &counter);
ck_assert(li != NULL);
ck_assert_notnull(li);
litest_disable_log_handler(li);
......@@ -248,7 +248,7 @@ START_TEST(path_create_destroy)
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
ck_assert_int_eq(counter.open_func_count, 1);
......@@ -282,7 +282,7 @@ START_TEST(path_set_user_data)
int data1, data2;
li = libinput_path_create_context(&simple_interface, &data1);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert(libinput_get_user_data(li) == &data1);
libinput_set_user_data(li, &data2);
ck_assert(libinput_get_user_data(li) == &data2);
......@@ -304,14 +304,14 @@ START_TEST(path_added_seat)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
type = libinput_event_get_type(event);
ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(event);
seat = libinput_device_get_seat(device);
ck_assert(seat != NULL);
ck_assert_notnull(seat);
seat_name = libinput_seat_get_logical_name(seat);
ck_assert_str_eq(seat_name, "default");
......@@ -355,7 +355,7 @@ START_TEST(path_seat_change)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_DEVICE_REMOVED);
......@@ -364,7 +364,7 @@ START_TEST(path_seat_change)
libinput_event_destroy(event);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_DEVICE_ADDED);
ck_assert(libinput_event_get_device(event) != device);
......@@ -433,7 +433,7 @@ START_TEST(path_add_device)
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_dispatch(li);
......@@ -493,7 +493,8 @@ START_TEST(path_device_sysname)
ck_assert_notnull(device);
sysname = libinput_device_get_sysname(device);
ck_assert(sysname != NULL && strlen(sysname) > 1);
ck_assert_notnull(sysname);
ck_assert_int_gt(strlen(sysname), 1);
ck_assert(strchr(sysname, '/') == NULL);
ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
......@@ -511,7 +512,7 @@ START_TEST(path_remove_device)
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
litest_drain_events(li);
libinput_path_remove_device(device);
......@@ -541,7 +542,7 @@ START_TEST(path_double_remove_device)
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(dev->uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
litest_drain_events(li);
libinput_path_remove_device(device);
......@@ -578,11 +579,11 @@ START_TEST(path_suspend)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_suspend(li);
libinput_resume(li);
......@@ -608,11 +609,11 @@ START_TEST(path_double_suspend)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_suspend(li);
libinput_suspend(li);
......@@ -639,11 +640,11 @@ START_TEST(path_double_resume)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_suspend(li);
libinput_resume(li);
......@@ -678,11 +679,11 @@ START_TEST(path_add_device_suspend_resume)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput2));
libinput_dispatch(li);
......@@ -756,14 +757,14 @@ START_TEST(path_add_device_suspend_resume_fail)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1));
ck_assert(device != NULL);
ck_assert_notnull(device);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput2));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_dispatch(li);
......@@ -843,11 +844,11 @@ START_TEST(path_add_device_suspend_resume_remove_device)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1));
ck_assert(device != NULL);
ck_assert_notnull(device);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput2));
......@@ -928,11 +929,11 @@ START_TEST(path_seat_recycle)
-1);
li = libinput_path_create_context(&simple_interface, userdata);
ck_assert(li != NULL);
ck_assert_notnull(li);
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput));
ck_assert(device != NULL);
ck_assert_notnull(device);
libinput_dispatch(li);
......@@ -941,12 +942,12 @@ START_TEST(path_seat_recycle)
type = libinput_event_get_type(ev);
ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(ev);
ck_assert(device != NULL);
ck_assert_notnull(device);
saved_seat = libinput_device_get_seat(device);
libinput_seat_set_user_data(saved_seat, &data);
libinput_seat_ref(saved_seat);
libinput_event_destroy(ev);
ck_assert(saved_seat != NULL);
ck_assert_notnull(saved_seat);
litest_assert_empty_queue(li);
......@@ -962,7 +963,7 @@ START_TEST(path_seat_recycle)
type = libinput_event_get_type(ev);
ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED);
device = libinput_event_get_device(ev);
ck_assert(device != NULL);
ck_assert_notnull(device);
seat = libinput_device_get_seat(device);
user_data = libinput_seat_get_user_data(seat);
......
......@@ -2033,7 +2033,7 @@ START_TEST(bad_distance_events)
litest_drain_events(li);
absinfo = libevdev_get_abs_info(dev->evdev, ABS_DISTANCE);
ck_assert(absinfo != NULL);
ck_assert_notnull(absinfo);
litest_event(dev, EV_ABS, ABS_DISTANCE, absinfo->maximum);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
......
......@@ -515,10 +515,10 @@ START_TEST(touch_calibrated_screen_udev)
int rc;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
......
......@@ -1300,7 +1300,7 @@ START_TEST(clickpad_softbutton_left_1st_fg_move)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
while (event) {
struct libinput_event_pointer *p;
......@@ -1366,7 +1366,7 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
while (event) {
struct libinput_event_pointer *p;
double x, y;
......@@ -1397,7 +1397,7 @@ START_TEST(clickpad_softbutton_left_2nd_fg_move)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
while (event) {
struct libinput_event_pointer *p;
double x, y;
......
......@@ -71,7 +71,7 @@ START_TEST(touchpad_1fg_motion)
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
while (event) {
ck_assert_int_eq(libinput_event_get_type(event),
......
......@@ -117,7 +117,7 @@ START_TEST(trackpoint_middlebutton_noscroll)
litest_assert_button_event(li, BTN_MIDDLE, 1);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event), LIBINPUT_EVENT_POINTER_MOTION);
libinput_event_destroy(event);
......
......@@ -66,7 +66,7 @@ START_TEST(udev_create_NULL)
ck_assert(li == NULL);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1);
libinput_unref(li);
......@@ -82,10 +82,10 @@ START_TEST(udev_create_seat0)
int fd;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li);
......@@ -94,7 +94,7 @@ START_TEST(udev_create_seat0)
/* expect at least one event */
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
libinput_event_destroy(event);
libinput_unref(li);
......@@ -110,11 +110,11 @@ START_TEST(udev_create_empty_seat)
int fd;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
/* expect a libinput reference, but no events */
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seatdoesntexist"), 0);
fd = libinput_get_fd(li);
......@@ -140,7 +140,7 @@ START_TEST(udev_create_seat_too_long)
seatname[sizeof(seatname) - 1] = '\0';
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert_notnull(li);
......@@ -162,10 +162,10 @@ START_TEST(udev_set_user_data)
int data1, data2;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, &data1, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert(libinput_get_user_data(li) == &data1);
libinput_set_user_data(li, &data2);
ck_assert(libinput_get_user_data(li) == &data2);
......@@ -191,10 +191,10 @@ START_TEST(udev_added_seat_default)
int default_seat_found = 0;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
......@@ -207,7 +207,7 @@ START_TEST(udev_added_seat_default)
device = libinput_event_get_device(event);
seat = libinput_device_get_seat(device);
ck_assert(seat != NULL);
ck_assert_notnull(seat);
seat_name = libinput_seat_get_logical_name(seat);
default_seat_found = streq(seat_name, "default");
......@@ -237,15 +237,15 @@ START_TEST(udev_change_seat)
int rc;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
ck_assert_int_eq(libinput_event_get_type(event),
LIBINPUT_EVENT_DEVICE_ADDED);
......@@ -304,10 +304,10 @@ START_TEST(udev_double_suspend)
int fd;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li);
......@@ -316,7 +316,7 @@ START_TEST(udev_double_suspend)
/* expect at least one event */
ck_assert_int_ge(libinput_dispatch(li), 0);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
libinput_suspend(li);
libinput_suspend(li);
......@@ -336,10 +336,10 @@ START_TEST(udev_double_resume)
int fd;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li);
......@@ -348,7 +348,7 @@ START_TEST(udev_double_resume)
/* expect at least one event */
ck_assert_int_ge(libinput_dispatch(li), 0);
event = libinput_get_event(li);
ck_assert(event != NULL);
ck_assert_notnull(event);
libinput_suspend(li);
libinput_resume(li);
......@@ -388,10 +388,10 @@ START_TEST(udev_suspend_resume)
int num_devices = 0;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
fd = libinput_get_fd(li);
......@@ -426,10 +426,10 @@ START_TEST(udev_resume_before_seat)
int rc;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
rc = libinput_resume(li);
ck_assert_int_eq(rc, 0);
......@@ -446,10 +446,10 @@ START_TEST(udev_suspend_resume_before_seat)
int rc;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
libinput_suspend(li);
rc = libinput_resume(li);
......@@ -469,10 +469,10 @@ START_TEST(udev_device_sysname)
struct udev *udev;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
......@@ -486,7 +486,8 @@ START_TEST(udev_device_sysname)
device = libinput_event_get_device(ev);
sysname = libinput_device_get_sysname(device);
ck_assert(sysname != NULL && strlen(sysname) > 1);
ck_assert_notnull(sysname);
ck_assert_int_gt(strlen(sysname), 1);
ck_assert(strchr(sysname, '/') == NULL);
ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
libinput_event_destroy(ev);
......@@ -510,10 +511,10 @@ START_TEST(udev_seat_recycle)
void *user_data;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
......@@ -524,7 +525,7 @@ START_TEST(udev_seat_recycle)
break;
device = libinput_event_get_device(ev);
ck_assert(device != NULL);
ck_assert_notnull(device);
saved_seat = libinput_device_get_seat(device);
libinput_seat_set_user_data(saved_seat, &data);
libinput_seat_ref(saved_seat);
......@@ -536,7 +537,7 @@ START_TEST(udev_seat_recycle)
libinput_event_destroy(ev);
}
ck_assert(saved_seat != NULL);
ck_assert_notnull(saved_seat);
libinput_suspend(li);
......@@ -549,7 +550,7 @@ START_TEST(udev_seat_recycle)
switch (libinput_event_get_type(ev)) {
case LIBINPUT_EVENT_DEVICE_ADDED:
device = libinput_event_get_device(ev);
ck_assert(device != NULL);
ck_assert_notnull(device);
seat = libinput_device_get_seat(device);
user_data = libinput_seat_get_user_data(seat);
......@@ -579,10 +580,10 @@ START_TEST(udev_path_add_device)
struct libinput_device *device;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
litest_set_log_handler_bug(li);
......@@ -603,17 +604,17 @@ START_TEST(udev_path_remove_device)
struct libinput_event *event;
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0);
libinput_dispatch(li);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED, -1);
event = libinput_get_event(li);
device = libinput_event_get_device(event);
ck_assert(device != NULL);
ck_assert_notnull(device);
/* no effect bug a bug log msg */
litest_set_log_handler_bug(li);
......@@ -639,17 +640,17 @@ START_TEST(udev_ignore_device)
devname = libevdev_get_name(dev->evdev);
udev = udev_new();
ck_assert(udev != NULL);
ck_assert_notnull(udev);
li = libinput_udev_create_context(&simple_interface, NULL, udev);
ck_assert(li != NULL);
ck_assert_notnull(li);
litest_restore_log_handler(li);