aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2018-03-15 21:59:39 +0100
committerJoel Klinghed <the_jk@spawned.biz>2018-03-19 21:52:34 +0100
commit8bad2d98277854ff58ef84c27b89604b544c279f (patch)
treeea52e30bae9bc49beb8fbbed405243bea6d7bdb0 /mesonbuild/scripts
parent79bb1df04faf96f03f2b5a6b2dcb95fcff1a3b0d (diff)
downloadmeson-8bad2d98277854ff58ef84c27b89604b544c279f.zip
meson-8bad2d98277854ff58ef84c27b89604b544c279f.tar.gz
meson-8bad2d98277854ff58ef84c27b89604b544c279f.tar.bz2
Exclude subprojects when doing coverage
Restore subproject exclusion for the html coverage report that existed in the ninja backend legacy target. Also exclude subprojects for the gcovr generated reports.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/coverage.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index dcc9465..eaa86fe 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -16,7 +16,7 @@ from mesonbuild import environment
import argparse, sys, os, subprocess, pathlib
-def coverage(outputs, source_root, build_root, log_dir):
+def coverage(outputs, source_root, subproject_root, build_root, log_dir):
outfiles = []
exitcode = 0
@@ -33,6 +33,7 @@ def coverage(outputs, source_root, build_root, log_dir):
subprocess.check_call([gcovr_exe,
'-x',
'-r', gcovr_rootdir,
+ '-e', subproject_root,
'-o', os.path.join(log_dir, 'coverage.xml'),
])
outfiles.append(('Xml', pathlib.Path(log_dir, 'coverage.xml')))
@@ -44,6 +45,7 @@ def coverage(outputs, source_root, build_root, log_dir):
if gcovr_exe:
subprocess.check_call([gcovr_exe,
'-r', gcovr_rootdir,
+ '-e', subproject_root,
'-o', os.path.join(log_dir, 'coverage.txt'),
])
outfiles.append(('Text', pathlib.Path(log_dir, 'coverage.txt')))
@@ -81,6 +83,11 @@ def coverage(outputs, source_root, build_root, log_dir):
'--extract', raw_tracefile,
os.path.join(source_root, '*'),
'--output-file', covinfo])
+ # Remove all directories inside subproject dir
+ subprocess.check_call([lcov_exe,
+ '--remove', covinfo,
+ os.path.join(subproject_root, '*'),
+ '--output-file', covinfo])
subprocess.check_call([genhtml_exe,
'--prefix', build_root,
'--output-directory', htmloutdir,
@@ -96,6 +103,7 @@ def coverage(outputs, source_root, build_root, log_dir):
'--html',
'--html-details',
'-r', build_root,
+ '-e', subproject_root,
'-o', os.path.join(htmloutdir, 'index.html'),
])
outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html')))
@@ -126,11 +134,13 @@ def run(args):
parser.add_argument('--html', dest='outputs', action='append_const',
const='html', help='generate Html report')
parser.add_argument('source_root')
+ parser.add_argument('subproject_root')
parser.add_argument('build_root')
parser.add_argument('log_dir')
options = parser.parse_args(args)
return coverage(options.outputs, options.source_root,
- options.build_root, options.log_dir)
+ options.subproject_root, options.build_root,
+ options.log_dir)
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))