mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 18:40:58 +01:00
While we can’t add markers to the macro implementations to cause lcov to ignore them automatically, we can change our lcov configuration to ignore all calls to them. See https://github.com/linux-test-project/lcov/issues/44. This causes all the un-takeable branches and un-reachable assertions to be ignored by our code coverage, which bumps our statistics: • Lines: 74.9% → 74.8% • Functions: 82.3% → 82.3% • Branches: 53.3% → 64.2% The rationale is that nobody should be testing programmer error handling, as g_return_*if_fail() are used to guard against — so it’s not reasonable to count missed branches like that in code coverage statistics. Signed-off-by: Philip Withnall <withnall@endlessm.com>
33 lines
694 B
Bash
Executable File
33 lines
694 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 --config-file .gitlab-ci/lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
|
|
# Remove any coverage from system files
|
|
lcov --config-file .gitlab-ci/lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
|
|
done
|
|
|
|
genhtml \
|
|
--ignore-errors=source \
|
|
--config-file .gitlab-ci/lcovrc \
|
|
_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
|