aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2018-02-27 21:46:08 +0100
committerJoel Klinghed <the_jk@spawned.biz>2018-02-27 21:58:05 +0100
commit6266089866469c2a2d298b79df74d2aad86bbeea (patch)
treedfdcd675b8a367c6433f7e3aa034a283be6379d7 /run_unittests.py
parentda017702613d718ac69ae213ee91358566f7b622 (diff)
downloadmeson-6266089866469c2a2d298b79df74d2aad86bbeea.zip
meson-6266089866469c2a2d298b79df74d2aad86bbeea.tar.gz
meson-6266089866469c2a2d298b79df74d2aad86bbeea.tar.bz2
Allow gcovr >= 3.1 to be used to generate html coverage report
Modern gcovr includes html generation support so if lcov and genhtml are not available fallback to gcovr. Kept lcov and genhtml as default so to not surprise existing users of coverage-html with the different output of gcovr. gcovr added html support in 3.0 but as there already is a test for 3.1 because of the changes to -r/--rootdir I opted to only allow html generation for >= 3.1 to keep things simple.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 41cbf39..4c48041 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2554,10 +2554,11 @@ class LinuxlikeTests(BasePlatformTests):
self.assertIn("-fsanitize=address", i["command"])
def test_coverage(self):
- if not shutil.which('gcovr'):
+ gcovr_exe, gcovr_3_1 = mesonbuild.environment.detect_gcovr()
+ if not gcovr_exe:
raise unittest.SkipTest('gcovr not found')
- if not shutil.which('genhtml'):
- raise unittest.SkipTest('genhtml not found')
+ if not shutil.which('genhtml') and not gcovr_3_1:
+ raise unittest.SkipTest('genhtml not found and gcovr is too old')
if 'clang' in os.environ.get('CC', ''):
# We need to use llvm-cov instead of gcovr with clang
raise unittest.SkipTest('Coverage does not work with clang right now, help wanted!')