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: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
This commit is contained in:
Peter Hutterer 2024-10-16 11:21:29 +10:00 committed by Marge Bot
parent efd3dd4427
commit d1575fbce5

View file

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