From d1575fbce5418b2b0eddeaac99f0f0b4492630b0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 16 Oct 2024 11:21:29 +1000 Subject: [PATCH] test: move the deviceless check into ltest_add_tcase This is out of place here, check this when we are about to add the test, not later when the tests are about to be run. Part-of: --- test/litest.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/litest.c b/test/litest.c index 1706c2fb..02a4252c 100644 --- a/test/litest.c +++ b/test/litest.c @@ -398,6 +398,9 @@ litest_add_tcase_for_device(struct suite *suite, { struct test *t; + if (run_deviceless) + return; + t = zalloc(sizeof(*t)); t->name = safe_strdup(funcname); t->devname = safe_strdup(dev->shortname); @@ -424,6 +427,9 @@ litest_add_tcase_no_device(struct suite *suite, fnmatch(filter_device, test_name, 0) != 0) return; + if (run_deviceless) + return; + t = zalloc(sizeof(*t)); t->name = safe_strdup(test_name); t->devname = safe_strdup("no device"); @@ -1024,14 +1030,6 @@ litest_run_suite(struct list *suites, int which, int max, int error_fd) TCase *tc; char *sname, *tname; - /* We run deviceless tests as part of the normal - * test suite runner, just in case. Filtering - * all the other ones out just for the case where - * we can't run the full runner. - */ - if (run_deviceless && !t->deviceless) - continue; - count = (count + 1) % max; if (max != 1 && (count % max) != which) continue; -- 2.34.1