test: move the rest of the custom initialization to litest_run
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 16 Oct 2024 01:04:08 +0000 (11:04 +1000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 30 Oct 2024 23:20:42 +0000 (23:20 +0000)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

test/litest.c

index 9a36909cd09220c4a76cca5d6a48fc74f4d80cf3..fa9f91df207e9f4736e9abc9202e51d30b0aaddf 100644 (file)
@@ -1113,9 +1113,15 @@ restore_tty(int tty_mode)
 static inline enum litest_runner_result
 litest_run(struct list *suites)
 {
+       const struct rlimit corelimit = { 0, 0 };
        int inhibit_lock_fd;
        int tty_mode = -1;
 
+       setenv("LIBINPUT_RUNNING_TEST_SUITE", "1", 1);
+
+       if (setrlimit(RLIMIT_CORE, &corelimit) != 0)
+               perror("WARNING: Core dumps not disabled");
+
        list_init(&created_files_list);
 
        if (run_deviceless) {
@@ -4818,7 +4824,6 @@ litest_free_test_list(struct list *tests)
 int
 main(int argc, char **argv)
 {
-       const struct rlimit corelimit = { 0, 0 };
        enum litest_mode mode;
        int rc;
        const char *meson_testthreads;
@@ -4857,12 +4862,6 @@ main(int argc, char **argv)
        if (!run_deviceless && (rc = check_device_access()) != 0)
                return rc;
 
-       setenv("CK_DEFAULT_TIMEOUT", "30", 0);
-       setenv("LIBINPUT_RUNNING_TEST_SUITE", "1", 1);
-
-       if (setrlimit(RLIMIT_CORE, &corelimit) != 0)
-               perror("WARNING: Core dumps not disabled");
-
        enum litest_runner_result result = litest_run(&all_test_suites);
 
        litest_free_test_list(&all_test_suites);