build: Move lcovrc file to root so it’s picked up by Meson

Move the lcovrc file to the root of the project, so that it’s picked up
by Meson when running `ninja coverage` locally.

See https://github.com/mesonbuild/meson/issues/4628

This won’t affect the code coverage run on the CI, since that explicitly
used the lcovrc file already.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall
2022-04-28 11:57:45 +01:00
parent a0aff5404c
commit 8e295e23a5
4 changed files with 7 additions and 7 deletions

View File

@@ -7,14 +7,14 @@ 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}"
lcov --config-file .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}"
lcov --config-file .lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
done
genhtml \
--ignore-errors=source \
--config-file .gitlab-ci/lcovrc \
--config-file .lcovrc \
_coverage/*.lcov \
-o _coverage/coverage

View File

@@ -1,13 +0,0 @@
# lcov and genhtml configuration
# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php
# Always enable branch coverage
lcov_branch_coverage = 1
# Exclude precondition assertions, as we can never reasonably get full branch
# coverage of them, as they should never normally fail.
# See https://github.com/linux-test-project/lcov/issues/44
lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_
# Similarly for unreachable assertions.
lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached

View File

@@ -44,7 +44,7 @@ ninja
lcov \
--quiet \
--config-file "${DIR}"/.gitlab-ci/lcovrc \
--config-file "${DIR}"/.lcovrc \
--directory "${DIR}/_build" \
--capture \
--initial \
@@ -61,7 +61,7 @@ python3 "${DIR}"/.gitlab-ci/meson-junit-report.py \
lcov \
--quiet \
--config-file "${DIR}"/.gitlab-ci/lcovrc \
--config-file "${DIR}"/.lcovrc \
--directory "${DIR}/_build" \
--capture \
--output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov"