From: Peter Hutterer Date: Mon, 11 Nov 2019 04:37:43 +0000 (+1000) Subject: test: allow for substring matching in the various --filter- arguments X-Git-Tag: 1.14.901~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a524cf97619f97c742f982065b6aa7698ca4779f;p=platform%2Fupstream%2Flibinput.git 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 --- 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;