]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Support getting test-coverage on just one test
authorSimon Glass <sjg@chromium.org>
Mon, 30 Sep 2024 18:51:37 +0000 (12:51 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 18 Oct 2024 20:10:22 +0000 (14:10 -0600)
Pass the arguments through to test_util so that a single test can be
used.

Update the docs and add some missing backquotes in the same section.

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

index f9a3a42183b43b63175df1d8398a240847283e11..c25914312a85de78422807aa3878a4fec17d9f59 100644 (file)
@@ -2099,12 +2099,15 @@ Code coverage
 -------------
 
 Binman is a critical tool and is designed to be very testable. Entry
-implementations target 100% test coverage. Run 'binman test -T' to check this.
+implementations target 100% test coverage. Run ``binman test -T`` to check this.
 
 To enable Python test coverage on Debian-type distributions (e.g. Ubuntu)::
 
    $ sudo apt-get install python-coverage python3-coverage python-pytest
 
+You can also check the coverage provided by a single test, e.g.::
+
+   binman test -T testSimple
 
 Exit status
 -----------
index dc817ddcd42bfc02162b16db88b92e7dcebd9644..619840e7d5508900ba8f56b7f159b073e84ba205 100755 (executable)
@@ -85,7 +85,7 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
 
     return (0 if result.wasSuccessful() else 1)
 
-def RunTestCoverage(toolpath, build_dir):
+def RunTestCoverage(toolpath, build_dir, args):
     """Run the tests and check that we get 100% coverage"""
     glob_list = control.GetEntryModules(False)
     all_set = set([os.path.splitext(os.path.basename(item))[0]
@@ -97,7 +97,7 @@ def RunTestCoverage(toolpath, build_dir):
     test_util.run_test_coverage('tools/binman/binman', None,
             ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*',
              'tools/u_boot_pylib/*'],
-            build_dir, all_set, extra_args or None)
+            build_dir, all_set, extra_args or None, args=args)
 
 def RunBinman(args):
     """Main entry point to binman once arguments are parsed
@@ -117,7 +117,7 @@ def RunBinman(args):
 
     if args.cmd == 'test':
         if args.test_coverage:
-            RunTestCoverage(args.toolpath, args.build_dir)
+            RunTestCoverage(args.toolpath, args.build_dir, args.tests)
         else:
             ret_code = RunTests(args.debug, args.verbosity, args.processes,
                                 args.test_preserve_dirs, args.tests,