[PATCH v3 02/10] binman: test name globbing support
Sam Day via B4 Relay
devnull+me.samcday.com at kernel.org
Wed Jun 10 03:27:40 CEST 2026
From: Sam Day <me at samcday.com>
This makes invocations like `binman test testAndroid*` possible. It also
composes well with the previous commit that adds support for multiple
test names: `binman test 'testAndroid*' 'testQcdt*'` also works as you'd
expect.
---
tools/binman/cmdline.py | 2 +-
tools/u_boot_pylib/test_util.py | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 9632ec115e5..b3be9f79b20 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -201,7 +201,7 @@ controlled by a description in the board device tree.'''
'preserve the output directory if a single test is run (pass '
'test name at the end of the command line')
test_parser.add_argument('tests', nargs='*',
- help='Test names to run (omit for all)')
+ help='Test names/patterns to run (omit for all)')
tool_parser = subparsers.add_parser('tool', help='Check bintools')
tool_parser.add_argument('-l', '--list', action='store_true',
diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index ff275a7b7c0..2089b3574ca 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -4,6 +4,7 @@
#
import doctest
+import fnmatch
import glob
import multiprocessing
import os
@@ -186,7 +187,9 @@ def run_test_suites(toolname, debug, verbosity, no_capture, test_preserve_dirs,
test_names = [test_name]
else:
test_names = list(test_name or [])
- test_name_set = set(test_names)
+
+ def _match_name(name):
+ return any(fnmatch.fnmatchcase(name, pattern) for pattern in test_names)
if use_concurrent and processes != 1 and not test_names:
suite = ConcurrentTestSuite(suite,
@@ -194,7 +197,7 @@ def run_test_suites(toolname, debug, verbosity, no_capture, test_preserve_dirs,
for module in class_and_module_list:
if (isinstance(module, str) and
- (not test_names or module in test_name_set)):
+ (not test_names or _match_name(module))):
suite.addTests(doctest.DocTestSuite(module))
for module in class_and_module_list:
@@ -211,9 +214,8 @@ def run_test_suites(toolname, debug, verbosity, no_capture, test_preserve_dirs,
# while traversing a name then a synthetic test that raises that
# error when run will be returned. Check that the requested test
# exists, otherwise these errors are included in the results.
- module_test_names = loader.getTestCaseNames(module)
- for name in test_names:
- if name in module_test_names:
+ for name in loader.getTestCaseNames(module):
+ if _match_name(name):
suite.addTests(loader.loadTestsFromName(name, module))
else:
suite.addTests(loader.loadTestsFromTestCase(module))
--
2.54.0
More information about the U-Boot
mailing list