mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
u_boot_pylib: Support running coverage on selected functions
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>
This commit is contained in:
parent
58918fa4f0
commit
c95a3c8890
1 changed files with 8 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue