From 3577369805062b82250a283b596b9caa7e10fe04 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 13 Oct 2024 19:16:32 +1000 Subject: [PATCH] test: switch unused argc/argv to the list of tests This means we don't rely on the "all_tests" global here though it also means we need to move the cleanup into the caller. Part-of: --- test/litest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/litest.c b/test/litest.c index 3f256f77..6a1a8135 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1273,14 +1273,14 @@ out: } static inline int -litest_run(int argc, char **argv) +litest_run(struct list *tests) { int failed = 0; int inhibit_lock_fd; list_init(&created_files_list); - if (list_empty(&all_tests)) { + if (list_empty(tests)) { fprintf(stderr, "Error: filters are too strict, no tests to run.\n"); return 1; @@ -1308,14 +1308,12 @@ litest_run(int argc, char **argv) inhibit_lock_fd = inhibit(); if (jobs == 1) - failed = litest_run_suite(&all_tests, 1, 1, STDERR_FILENO); + failed = litest_run_suite(tests, 1, 1, STDERR_FILENO); else - failed = litest_fork_subtests(&all_tests, jobs); + failed = litest_fork_subtests(tests, jobs); close(inhibit_lock_fd); - litest_free_test_list(&all_tests); - litest_remove_udev_rules(&created_files_list); return failed; @@ -4962,7 +4960,9 @@ main(int argc, char **argv) tty_mode = disable_tty(); - failed_tests = litest_run(argc, argv); + failed_tests = litest_run(&all_tests); + + litest_free_test_list(&all_tests); if (tty_mode != -1) { ioctl(STDIN_FILENO, KDSKBMODE, tty_mode);