mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
69ae2f4242
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.
33 lines
682 B
Bash
Executable File
33 lines
682 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Fixup Windows paths
|
|
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
|
|
|
|
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 \
|
|
--ignore-errors=source \
|
|
--rc lcov_branch_coverage=1 \
|
|
_coverage/*.lcov \
|
|
-o _coverage/coverage
|
|
|
|
cd _coverage
|
|
rm -f *.lcov
|
|
|
|
cat >index.html <<EOL
|
|
<html>
|
|
<body>
|
|
<ul>
|
|
<li><a href="coverage/index.html">Coverage</a></li>
|
|
</ul>
|
|
</body>
|
|
</html>
|
|
EOL
|