aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/coverage.py
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2018-02-27 21:41:48 +0100
committerJoel Klinghed <the_jk@spawned.biz>2018-02-27 21:48:42 +0100
commitda017702613d718ac69ae213ee91358566f7b622 (patch)
treec414e7c2a6454d37e16daa0f8f2d9a2dbe8b9beb /mesonbuild/scripts/coverage.py
parent16f80b4c506bba9839e30bd98fcbbafddcef3632 (diff)
downloadmeson-da017702613d718ac69ae213ee91358566f7b622.zip
meson-da017702613d718ac69ae213ee91358566f7b622.tar.gz
meson-da017702613d718ac69ae213ee91358566f7b622.tar.bz2
Fix coverage-xml and coverage-text targets for gcovr >= 3.1
In gcovr 3.1 the -r/--rootdir argument changed meaning causing reports generated with gcovr 3.1 to not find the source files and look for *.gcda in the whole source tree rather than the build dir. So, detect gcovr version and if 3.1 give build_root to -r instead of source_root.
Diffstat (limited to 'mesonbuild/scripts/coverage.py')
-rw-r--r--mesonbuild/scripts/coverage.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index 47f4cda..4746134 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -17,15 +17,20 @@ from mesonbuild import environment
import sys, os, subprocess, pathlib
def coverage(source_root, build_root, log_dir):
- (gcovr_exe, lcov_exe, genhtml_exe) = environment.find_coverage_tools()
+ (gcovr_exe, gcovr_3_1, lcov_exe, genhtml_exe) = environment.find_coverage_tools()
if gcovr_exe:
+ # gcovr >= 3.1 interprets rootdir differently
+ if gcovr_3_1:
+ rootdir = build_root
+ else:
+ rootdir = source_root
subprocess.check_call([gcovr_exe,
'-x',
- '-r', source_root,
+ '-r', rootdir,
'-o', os.path.join(log_dir, 'coverage.xml'),
])
subprocess.check_call([gcovr_exe,
- '-r', source_root,
+ '-r', rootdir,
'-o', os.path.join(log_dir, 'coverage.txt'),
])
if lcov_exe and genhtml_exe: