public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/3] u_boot_pylib: Support running coverage on selected functions
@ 2024-09-30 18:51 Simon Glass
  2024-09-30 18:51 ` [PATCH 2/3] binman: Support getting test-coverage on just one test Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Simon Glass @ 2024-09-30 18:51 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Brian Ruley, Marek Vasut, Simon Glass

At present run_test_coverage() assumes you want code coverage for the
entire code base. This is the normal situation, but sometimes it is
useful to see the coverage provided by just a single test. Add support
for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/u_boot_pylib/test_util.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index 857ce58c98c..dd671965263 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -23,8 +23,9 @@ except:
     use_concurrent = False
 
 
-def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None,
-                    extra_args=None, single_thread='-P1'):
+def run_test_coverage(prog, filter_fname, exclude_list, build_dir,
+                      required=None, extra_args=None, single_thread='-P1',
+                      args=None):
     """Run tests and check that we get 100% coverage
 
     Args:
@@ -42,6 +43,7 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None
         single_thread (str): Argument string to make the tests run
             single-threaded. This is necessary to get proper coverage results.
             The default is '-P0'
+        args (list of str): List of tests to run, or None to run all
 
     Raises:
         ValueError if the code coverage is not 100%
@@ -66,9 +68,10 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None
                'coverage')
 
     cmd = ('%s%s run '
-           '--omit "%s" %s %s %s %s' % (prefix, covtool, ','.join(glob_list),
-                                        prog, extra_args or '', test_cmd,
-                                        single_thread or '-P1'))
+           '--omit "%s" %s %s %s %s %s' % (prefix, covtool, ','.join(glob_list),
+                                           prog, extra_args or '', test_cmd,
+                                           single_thread or '-P1',
+                                           ' '.join(args) if args else ''))
     os.system(cmd)
     stdout = command.output(covtool, 'report')
     lines = stdout.splitlines()
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-17 23:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 18:51 [PATCH 1/3] u_boot_pylib: Support running coverage on selected functions Simon Glass
2024-09-30 18:51 ` [PATCH 2/3] binman: Support getting test-coverage on just one test Simon Glass
2024-10-17 23:11   ` Simon Glass
2024-09-30 18:51 ` [PATCH 3/3] binman: Add a tutorial on resolving test-coverage bugs Simon Glass
2024-09-30 20:30   ` Heinrich Schuchardt
2024-10-08 13:13   ` Mattijs Korpershoek
2024-10-17 23:11     ` Simon Glass
2024-10-17 23:11 ` [PATCH 1/3] u_boot_pylib: Support running coverage on selected functions Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox