summaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-17 22:00:54 -0600
committerSimon Glass <sjg@chromium.org>2019-07-10 16:52:58 -0600
commit9550f9acd64449a739b2db90c64e63a6269d81d8 (patch)
tree0b6df971db8943b947b6caf74c984499d22208d2 /tools/patman
parent5385f5a0183cfb0b6f86ec2b55d40b67a4acfe57 (diff)
patman: Update cover-coverage tests for Python 3
We need slightly different commands to run code coverage with Python 3. Update the RunTestCoverage() function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rw-r--r--tools/patman/test_util.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index e462ec8f72..ea36cd1633 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -17,6 +17,8 @@ try:
except ImportError:
from io import StringIO
+PYTHON = 'python%d' % sys.version_info[0]
+
def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
"""Run tests and check that we get 100% coverage
@@ -43,11 +45,12 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
else:
glob_list = []
glob_list += exclude_list
- glob_list += ['*libfdt.py', '*site-packages*']
- cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools python-coverage run '
- '--omit "%s" %s -P1 -t' % (build_dir, ','.join(glob_list), prog))
+ glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
+ cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run '
+ '--omit "%s" %s -P1 -t' % (build_dir, PYTHON, ','.join(glob_list),
+ prog))
os.system(cmd)
- stdout = command.Output('python-coverage', 'report')
+ stdout = command.Output('%s-coverage' % PYTHON, 'report')
lines = stdout.splitlines()
if required:
# Convert '/path/to/name.py' just the module name 'name'
@@ -65,8 +68,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
print(coverage)
if coverage != '100%':
print(stdout)
- print("Type 'python-coverage html' to get a report in "
- 'htmlcov/index.html')
+ print("Type '%s-coverage html' to get a report in "
+ 'htmlcov/index.html' % PYTHON)
print('Coverage error: %s, but should be 100%%' % coverage)
ok = False
if not ok: