aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-06-01 09:38:18 -0600
committerSimon Glass <sjg@chromium.org>2018-06-07 11:25:08 -0800
commit084059a31fd3455770acc393b0e0d07c5ed88eec (patch)
tree1ba8070170dd32ad2d1b29a36903384045fa4444 /tools
parent258fb0e677b63e5b92413eae1f05f82213d9e43a (diff)
downloadu-boot-084059a31fd3455770acc393b0e0d07c5ed88eec.zip
u-boot-084059a31fd3455770acc393b0e0d07c5ed88eec.tar.gz
u-boot-084059a31fd3455770acc393b0e0d07c5ed88eec.tar.bz2
binman: Allow a single test to be executed
Provide an easy way to execute a single binman test by specifying it on the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/binman/binman.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index d49402a..31b0453 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -27,8 +27,14 @@ import cmdline
import command
import control
-def RunTests(debug):
- """Run the functional tests and any embedded doctests"""
+def RunTests(debug, args):
+ """Run the functional tests and any embedded doctests
+
+ Args:
+ debug: True to enable debugging, which shows a full stack trace on error
+ args: List of positional args provided to binman. This can hold a test
+ name to execute (as in 'binman -t testSections', for example)
+ """
import elf_test
import entry_test
import fdt_test
@@ -50,9 +56,16 @@ def RunTests(debug):
# 'entry' module.
suite = unittest.TestLoader().loadTestsFromTestCase(entry_test.TestEntry)
suite.run(result)
+ test_name = args and args[0] or None
for module in (ftest.TestFunctional, fdt_test.TestFdt, elf_test.TestElf,
image_test.TestImage):
- suite = unittest.TestLoader().loadTestsFromTestCase(module)
+ if test_name:
+ try:
+ suite = unittest.TestLoader().loadTestsFromName(args[0], module)
+ except AttributeError:
+ continue
+ else:
+ suite = unittest.TestLoader().loadTestsFromTestCase(module)
suite.run(result)
print result
@@ -111,7 +124,7 @@ def RunBinman(options, args):
sys.tracebacklimit = 0
if options.test:
- ret_code = RunTests(options.debug)
+ ret_code = RunTests(options.debug, args[1:])
elif options.test_coverage:
RunTestCoverage()