CI: Include coverage data of code which isn't executed by the test suite.

See comment in !151. Using the "--initial" option of lcov we collect
the coverage of all compiled files and merge them later into the final
report. This way we can see which files are built but never executed
by the test suite.

Because the --initial switch also collects files in the ccache directory
we have to point it to the build directory instead, which in turn breaks
--no-external. Instead of using --no-external in the collection step,
filter out any files not in the source tree in the final coverage job
through a path filter.
This commit is contained in:
Christoph Reiter
2018-07-06 09:33:22 +02:00
parent c5321810f4
commit 69ae2f4242
3 changed files with 25 additions and 13 deletions

View File

@@ -5,9 +5,11 @@ set -e
# Fixup Windows paths
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
# Remove coverage from generated code in the build directory
for path in _coverage/*.lcov; do
# Remove coverage from generated code in the build directory
lcov --rc lcov_branch_coverage=1 -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
# Remove any coverage from system files
lcov --rc lcov_branch_coverage=1 -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
done
genhtml \