binman: Tidy up execution of tests
authorSimon Glass <sjg@chromium.org>
Fri, 6 Jul 2018 16:27:18 +0000 (10:27 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 9 Jul 2018 15:11:00 +0000 (09:11 -0600)
Move all the test execution into the same mechanism so that we can request
a particular test (from any suite) by passing it as an argument to
'binman -t'.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/binman.py

index 944fd5d7ba309d74a85f75ca3270ac51a7f080b6..74862b1146eb69dab374c3102a80a877e4c407a1 100755 (executable)
@@ -54,14 +54,12 @@ def RunTests(debug, args):
 
     # Run the entry tests first ,since these need to be the first to import the
     # '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):
+    for module in (entry_test.TestEntry, ftest.TestFunctional, fdt_test.TestFdt,
+                   elf_test.TestElf, image_test.TestImage):
         if test_name:
             try:
-                suite = unittest.TestLoader().loadTestsFromName(args[0], module)
+                suite = unittest.TestLoader().loadTestsFromName(test_name, module)
             except AttributeError:
                 continue
         else: