Skip to content

Commit

Permalink
buildman: Make use of test_util
Browse files Browse the repository at this point in the history
Use test_util to run the tests, with the ability to select a single test
to run, if desired.

Signed-off-by: Simon Glass <sjg@chromium.org>
  • Loading branch information
sjg20 authored and trini committed Feb 9, 2022
1 parent 433fa54 commit d10dc40
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions tools/buildman/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,26 @@
from patman import patchstream
from patman import gitutil
from patman import terminal
from patman import test_util

def RunTests(skip_net_tests):
def RunTests(skip_net_tests, verboose, args):
import func_test
import test
import doctest

result = unittest.TestResult()
for module in ['buildman.toolchain', 'patman.gitutil']:
suite = doctest.DocTestSuite(module)
suite.run(result)

sys.argv = [sys.argv[0]]
test_name = args and args[0] or None
if skip_net_tests:
test.use_network = False
for module in (test.TestBuild, func_test.TestFunctional):
suite = unittest.TestLoader().loadTestsFromTestCase(module)
suite.run(result)

print(result)
for test, err in result.errors:
print(err)
for test, err in result.failures:
print(err)
# Run the entry tests first ,since these need to be the first to import the
# 'entry' module.
test_util.RunTestSuites(
result, False, verboose, False, None, test_name, [],
[test.TestBuild, func_test.TestFunctional,
'buildman.toolchain', 'patman.gitutil'])

return test_util.ReportResult('buildman', test_name, result)

options, args = cmdline.ParseArgs()

Expand All @@ -59,7 +55,7 @@ def RunTests(skip_net_tests):

# Run our meagre tests
if options.test:
RunTests(options.skip_net_tests)
RunTests(options.skip_net_tests, options.verbose, args)

# Build selected commits for selected boards
else:
Expand Down

0 comments on commit d10dc40

Please sign in to comment.