From 433fa549e138a06085fe3a9a0ac4924bb1804687 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 22 Jan 2022 05:07:29 -0700 Subject: buildman: Add a flag to control the traceback At present the full horror of the Python traceback is shown by default. It is normally only useful for debugging. Turn it off by default and add a --debug flag to enable it. Signed-off-by: Simon Glass --- tools/buildman/main.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/buildman/main.py') diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 2b714739a2..04698ce9e5 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -54,6 +54,9 @@ def RunTests(skip_net_tests): options, args = cmdline.ParseArgs() +if not options.debug: + sys.tracebacklimit = 0 + # Run our meagre tests if options.test: RunTests(options.skip_net_tests) -- cgit v1.2.3 From d10dc4028373a177b006283b93d5c245428fe774 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 22 Jan 2022 05:07:30 -0700 Subject: buildman: Make use of test_util Use test_util to run the tests, with the ability to select a single test to run, if desired. Signed-off-by: Simon Glass --- tools/buildman/main.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'tools/buildman/main.py') diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 04698ce9e5..c6af311a69 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -27,30 +27,26 @@ from buildman import toolchain 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() @@ -59,7 +55,7 @@ if not options.debug: # 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: -- cgit v1.2.3