aboutsummaryrefslogtreecommitdiff
path: root/tools/buildman
diff options
context:
space:
mode:
authorSimon Glass2023-07-19 17:49:31 -0600
committerSimon Glass2023-07-24 09:34:11 -0600
commit407a1413e3202585ca842896365718873b170ee2 (patch)
tree6dc8022ef897d3b8126220c11f3cd218769d21f9 /tools/buildman
parentba8d099b95f2125605e26316f7187a33495bb82c (diff)
buildman: Enable test coverage
Enable measuring test coverage for buildman so we can see the gaps. It is currently at 68%. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman')
-rw-r--r--tools/buildman/cmdline.py2
-rwxr-xr-xtools/buildman/main.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 052e223597c..03211bd5aa5 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -142,6 +142,8 @@ def add_after_m(parser):
help='Skip tests which need the network')
parser.add_argument('-t', '--test', action='store_true', dest='test',
default=False, help='run tests')
+ parser.add_argument('--coverage', action='store_true',
+ help='Calculated test coverage')
parser.add_argument('-T', '--threads', type=int,
default=None,
help='Number of builder threads to use (0=single-thread)')
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index a7f456bc819..5f42a58ddbb 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -48,12 +48,22 @@ def run_tests(skip_net_tests, debug, verbose, args):
# Run the entry tests first ,since these need to be the first to import the
# 'entry' module.
result = test_util.run_test_suites(
- 'buildman', debug, verbose, False, None, test_name, [],
+ 'buildman', debug, verbose, False, args.threads, test_name, [],
[test.TestBuild, func_test.TestFunctional,
'buildman.toolchain', 'patman.gitutil'])
return (0 if result.wasSuccessful() else 1)
+def run_test_coverage():
+ """Run the tests and check that we get 100% coverage"""
+ test_util.run_test_coverage(
+ 'tools/buildman/buildman', None,
+ ['tools/patman/*.py', 'tools/u_boot_pylib/*', '*test_fdt.py',
+ 'tools/buildman/kconfiglib.py', 'tools/buildman/*test*.py',
+ 'tools/buildman/main.py'],
+ '/tmp/b', single_thread='-T1')
+
+
def run_buildman():
"""Run bulidman
@@ -69,6 +79,9 @@ def run_buildman():
if cmdline.HAS_TESTS and args.test:
return run_tests(args.skip_net_tests, args.debug, args.verbose, args)
+ elif cmdline.HAS_TESTS and args.coverage:
+ run_test_coverage()
+
elif args.full_help:
tools.print_full_help(str(files('buildman').joinpath('README.rst')))