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: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
This commit is contained in:
Peter Hutterer 2024-10-13 19:16:32 +10:00 committed by Marge Bot
parent b89b0ccafb
commit 3577369805

View file

@ -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);