All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] test: Allow simple glob pattern in the test name
@ 2021-02-03 15:32 Andy Shevchenko
  2021-02-05  3:17 ` Simon Glass
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2021-02-03 15:32 UTC (permalink / raw)
  To: u-boot

When run `ut dm [test name]` allow to use simple pattern to run all tests
started with given prefix. For example, to run all ACPI test cases:
	ut dm acpi*

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 test/dm/test-main.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 69458d62c869..f15527e13d7b 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -129,17 +129,23 @@ static bool dm_test_run_on_flattree(struct unit_test *test)
 
 static bool test_matches(const char *test_name, const char *find_name)
 {
-	if (!find_name)
+	size_t len = find_name ? strlen(find_name) : 0;
+
+	/* Allow glob expansion in the test name */
+	if (len && find_name[len - 1] == '*')
+		len--;
+
+	if (!len)
 		return true;
 
-	if (!strcmp(test_name, find_name))
+	if (!strncmp(test_name, find_name, len))
 		return true;
 
 	/* All tests have this prefix */
 	if (!strncmp(test_name, "dm_test_", 8))
 		test_name += 8;
 
-	if (!strcmp(test_name, find_name))
+	if (!strncmp(test_name, find_name, len))
 		return true;
 
 	return false;
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-08 17:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 15:32 [PATCH v1] test: Allow simple glob pattern in the test name Andy Shevchenko
2021-02-05  3:17 ` Simon Glass
2021-02-05 17:34   ` Andy Shevchenko
2021-02-05 18:15     ` Andy Shevchenko
2021-02-05 18:18       ` Andy Shevchenko
2021-02-05 19:17       ` Andy Shevchenko
2021-02-05 20:46         ` Andy Shevchenko
2021-02-07 14:37           ` Simon Glass
2021-02-08 11:34             ` Andy Shevchenko
2021-02-08 17:07               ` Simon Glass
2021-02-08 17:34                 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.