test: init the global devices/test lists immediately
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 16 Oct 2024 01:10:18 +0000 (11:10 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 16 Oct 2024 08:03:03 +0000 (18:03 +1000)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

test/litest.c

index 0b2d8ee83bdd6d4a2780694449bee88c70039654..bd7568bf40e92a6ac8c83971bcfe469affecff1c 100644 (file)
@@ -395,9 +395,9 @@ void litest_generic_device_teardown(void)
        current_device = NULL;
 }
 
-static struct list devices;
+static struct list devices = LIST_INIT(devices); /* struct litest_test_device */
 
-static struct list all_tests;
+static struct list all_tests = LIST_INIT(all_tests); /* struct suite */
 
 static inline void
 litest_system(const char *command)
@@ -5035,10 +5035,8 @@ main(int argc, char **argv)
        if (mode == LITEST_MODE_ERROR)
                return EXIT_FAILURE;
 
-       list_init(&devices);
        litest_init_test_devices(&devices);
 
-       list_init(&all_tests);
        setup_tests();
        if (mode == LITEST_MODE_LIST) {
                litest_list_tests(&all_tests);