test: replace ck_abort with litest_abort_msg()
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 8 Oct 2024 09:27:28 +0000 (19:27 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 15 Oct 2024 02:44:27 +0000 (12:44 +1000)
Weirdly, that also required initializing two variables to NULL to stop a
compiler warning.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

test/litest.c
test/test-pad.c
test/test-path.c
test/test-switch.c
test/test-tablet.c
test/test-touchpad.c

index bdbc4434ae6728ab905fe892b4f44109ab5f6c74..c7d5dcbe9cbf56f2ffba1849fa033c3861d3fd88 100644 (file)
@@ -1652,7 +1652,7 @@ litest_create(enum litest_device_type which,
        }
 
        if (!found)
-               ck_abort_msg("Invalid device type %d\n", which);
+               litest_abort_msg("Invalid device type %d\n", which);
 
        d = zalloc(sizeof(*d));
        d->which = which;
@@ -3730,7 +3730,7 @@ litest_is_touch_event(struct libinput_event *event,
                litest_assert_event_type(event, type);
                break;
        default:
-               ck_abort_msg("%s: invalid touch type %d\n", __func__, type);
+               litest_abort_msg("%s: invalid touch type %d\n", __func__, type);
        }
 
        touch = libinput_event_get_touch_event(event);
index 325e3e9def7a2be0cfe225b42a9f035818bfcd3a..3c867c83291f3f83f0ee036274ff0d8287853ff5 100644 (file)
@@ -530,7 +530,7 @@ START_TEST(pad_dial_low_res)
                        ck_assert_double_eq(v120, 120.0 * direction);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Invalid dial code");
                }
                libinput_event_destroy(ev);
        }
index 6e2bee031ab69553d07ad78dd6fbf9d608e29cfc..bcb4c249c2661fa23a6ba1a43900f70acb4c7517 100644 (file)
@@ -784,7 +784,7 @@ START_TEST(path_add_device_suspend_resume_fail)
                 * causing a removed event for the first one */
                if (type != LIBINPUT_EVENT_DEVICE_ADDED &&
                    type != LIBINPUT_EVENT_DEVICE_REMOVED)
-                       ck_abort();
+                       litest_abort_msg("Unexpected event type");
                libinput_event_destroy(event);
                nevents++;
        }
index 15dbee7b666d277f6c9bd5c7786d54d239faad2d..260132ab012e327747d1ec3b02934a38f84a172d 100644 (file)
@@ -995,7 +995,7 @@ START_TEST(tablet_mode_disable_touchpad_on_resume)
                        have_switch_toggle = true;
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected event type");
                }
                libinput_event_destroy(event);
        }
@@ -1212,7 +1212,7 @@ START_TEST(tablet_mode_disable_keyboard_on_resume)
                        have_switch_toggle = true;
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected event type");
                }
                libinput_event_destroy(event);
        }
index 5712dfe3d2ddae5d98d905b30b43ba1b5527f9fc..c87f2ee7e7958bff96f59347a592d4fee360b826 100644 (file)
@@ -107,7 +107,7 @@ START_TEST(button_seat_count)
        struct libinput *li = dev->libinput;
        struct libinput_event *event;
        struct libinput_event_tablet_tool *tev;
-       struct litest_device *dev2;
+       struct litest_device *dev2 = NULL;
        struct axis_replacement axes[] = {
                { ABS_DISTANCE, 10 },
                { ABS_PRESSURE, 0 },
@@ -123,7 +123,7 @@ START_TEST(button_seat_count)
                dev2 = litest_add_device(li, LITEST_DELL_CANVAS_TOTEM);
                break;
        default:
-               ck_abort();
+               litest_abort_msg("Invalid button code");
        }
 
        litest_tablet_proximity_in(dev, 10, 10, axes);
@@ -2376,7 +2376,7 @@ START_TEST(tool_id)
        struct libinput_event_tablet_tool *tablet_event;
        struct libinput_event *event;
        struct libinput_tablet_tool *tool;
-       uint64_t tool_id;
+       uint64_t tool_id = 0;
 
        litest_drain_events(li);
 
@@ -2402,7 +2402,7 @@ START_TEST(tool_id)
                tool_id = 2083;
                break;
        default:
-               ck_abort();
+               litest_abort_msg("Invalid button code");
        }
 
        ck_assert(tool_id == libinput_tablet_tool_get_tool_id(tool));
index b9315fabd414a616b0e43ec70879b7c80d641af1..27aa59b7c495a5a9727fe35bb5e364f6df58e8a8 100644 (file)
@@ -6981,7 +6981,7 @@ START_TEST(touchpad_suspend_abba)
                        litest_sendevents_off(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                litest_drain_events(li);
@@ -7019,7 +7019,7 @@ START_TEST(touchpad_suspend_abba)
                        litest_sendevents_on(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                assert_touchpad_does_not_move(tp);
@@ -7043,7 +7043,7 @@ START_TEST(touchpad_suspend_abba)
                        litest_sendevents_on(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                litest_drain_events(li);
@@ -7120,7 +7120,7 @@ START_TEST(touchpad_suspend_abab)
                        litest_sendevents_off(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                litest_drain_events(li);
@@ -7148,7 +7148,7 @@ START_TEST(touchpad_suspend_abab)
                        litest_sendevents_off(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                assert_touchpad_does_not_move(tp);
@@ -7172,7 +7172,7 @@ START_TEST(touchpad_suspend_abab)
                        litest_sendevents_on(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                litest_drain_events(li);
@@ -7199,7 +7199,7 @@ START_TEST(touchpad_suspend_abab)
                        litest_sendevents_on(tp);
                        break;
                default:
-                       ck_abort();
+                       litest_abort_msg("Unexpected suspend option");
                }
 
                litest_drain_events(li);