diff options
author | Joel Klinghed <the_jk@spawned.biz> | 2018-02-27 21:46:08 +0100 |
---|---|---|
committer | Joel Klinghed <the_jk@spawned.biz> | 2018-02-27 21:58:05 +0100 |
commit | 6266089866469c2a2d298b79df74d2aad86bbeea (patch) | |
tree | dfdcd675b8a367c6433f7e3aa034a283be6379d7 /mesonbuild/scripts/coverage.py | |
parent | da017702613d718ac69ae213ee91358566f7b622 (diff) | |
download | meson-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 'mesonbuild/scripts/coverage.py')
-rw-r--r-- | mesonbuild/scripts/coverage.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py index 4746134..564286a 100644 --- a/mesonbuild/scripts/coverage.py +++ b/mesonbuild/scripts/coverage.py @@ -70,13 +70,21 @@ def coverage(source_root, build_root, log_dir): '--show-details', '--branch-coverage', covinfo]) + elif gcovr_exe and gcovr_3_1: + htmloutdir = os.path.join(log_dir, 'coveragereport') + subprocess.check_call([gcovr_exe, + '--html', + '--html-details', + '-r', build_root, + '-o', os.path.join(htmloutdir, 'index.html'), + ]) if gcovr_exe: print('') print('XML coverage report can be found at', pathlib.Path(log_dir, 'coverage.xml').as_uri()) print('Text coverage report can be found at', pathlib.Path(log_dir, 'coverage.txt').as_uri()) - if lcov_exe and genhtml_exe: + if (lcov_exe and genhtml_exe) or (gcovr_exe and gcovr_3_1): print('Html coverage report can be found at', pathlib.Path(htmloutdir, 'index.html').as_uri()) return 0 |