summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-11-11 14:37:43 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-11-15 00:24:00 +0000
commita524cf97619f97c742f982065b6aa7698ca4779f (patch)
tree553f00b4f498126f10295a2ced9f75ed511fa740 /test
parent2c4105ae5138298ccb733f226480cbe55f5f41ad (diff)
test: allow for substring matching in the various --filter- arguments
A unique substring of a test/group/device should be enough to filter, even without surrounding it with asterisks. This allows for things like --filter-device=t440 as opposed to the previous --filter-device="*t440*". Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/litest.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/litest.c b/test/litest.c
index f6a8f07d..d517c461 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -337,6 +337,7 @@ litest_add_tcase_no_device(struct suite *suite,
const char *test_name = funcname;
if (filter_device &&
+ strstr(test_name, filter_device) == NULL &&
fnmatch(filter_device, test_name, 0) != 0)
return;
@@ -362,6 +363,7 @@ litest_add_tcase_deviceless(struct suite *suite,
const char *test_name = funcname;
if (filter_device &&
+ strstr(test_name, filter_device) == NULL &&
fnmatch(filter_device, test_name, 0) != 0)
return;
@@ -431,10 +433,12 @@ litest_add_tcase(const char *suite_name,
litest_assert(excluded >= LITEST_DEVICELESS);
if (filter_test &&
+ strstr(funcname, filter_test) == NULL &&
fnmatch(filter_test, funcname, 0) != 0)
return;
if (filter_group &&
+ strstr(suite_name, filter_group) == NULL &&
fnmatch(filter_group, suite_name, 0) != 0)
return;
@@ -456,6 +460,7 @@ litest_add_tcase(const char *suite_name,
continue;
if (filter_device &&
+ strstr(dev->shortname, filter_device) == NULL &&
fnmatch(filter_device, dev->shortname, 0) != 0)
continue;
if ((dev->features & required) != required ||
@@ -477,6 +482,7 @@ litest_add_tcase(const char *suite_name,
continue;
if (filter_device &&
+ strstr(dev->shortname, filter_device) == NULL &&
fnmatch(filter_device, dev->shortname, 0) != 0)
continue;
@@ -580,16 +586,19 @@ _litest_add_ranged_for_device(const char *name,
litest_assert(type < LITEST_NO_DEVICE);
if (filter_test &&
+ strstr(funcname, filter_test) == NULL &&
fnmatch(filter_test, funcname, 0) != 0)
return;
if (filter_group &&
+ strstr(name, filter_group) == NULL &&
fnmatch(filter_group, name, 0) != 0)
return;
s = get_suite(name);
list_for_each(dev, &devices, node) {
if (filter_device &&
+ strstr(dev->shortname, filter_device) == NULL &&
fnmatch(filter_device, dev->shortname, 0) != 0) {
device_filtered = true;
continue;