mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
patman: Drop the python2 code in test coverage
We don't need to run test coverage with Python 2 now. Drop the special-case code. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -12,8 +12,6 @@ import command
|
|||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
PYTHON = 'python%d' % sys.version_info[0]
|
|
||||||
|
|
||||||
|
|
||||||
def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
|
def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
|
||||||
"""Run tests and check that we get 100% coverage
|
"""Run tests and check that we get 100% coverage
|
||||||
@@ -42,11 +40,14 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
|
|||||||
glob_list += exclude_list
|
glob_list += exclude_list
|
||||||
glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
|
glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
|
||||||
test_cmd = 'test' if 'binman' in prog else '-t'
|
test_cmd = 'test' if 'binman' in prog else '-t'
|
||||||
cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run '
|
prefix = ''
|
||||||
'--omit "%s" %s %s -P1' % (build_dir, PYTHON, ','.join(glob_list),
|
if build_dir:
|
||||||
|
prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir
|
||||||
|
cmd = ('%spython3-coverage run '
|
||||||
|
'--omit "%s" %s %s -P1' % (prefix, ','.join(glob_list),
|
||||||
prog, test_cmd))
|
prog, test_cmd))
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
stdout = command.Output('%s-coverage' % PYTHON, 'report')
|
stdout = command.Output('python3-coverage', 'report')
|
||||||
lines = stdout.splitlines()
|
lines = stdout.splitlines()
|
||||||
if required:
|
if required:
|
||||||
# Convert '/path/to/name.py' just the module name 'name'
|
# Convert '/path/to/name.py' just the module name 'name'
|
||||||
@@ -65,8 +66,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
|
|||||||
print(coverage)
|
print(coverage)
|
||||||
if coverage != '100%':
|
if coverage != '100%':
|
||||||
print(stdout)
|
print(stdout)
|
||||||
print("Type '%s-coverage html' to get a report in "
|
print("Type 'python3-coverage html' to get a report in "
|
||||||
'htmlcov/index.html' % PYTHON)
|
'htmlcov/index.html')
|
||||||
print('Coverage error: %s, but should be 100%%' % coverage)
|
print('Coverage error: %s, but should be 100%%' % coverage)
|
||||||
ok = False
|
ok = False
|
||||||
if not ok:
|
if not ok:
|
||||||
|
Reference in New Issue
Block a user