ci: Add lcov configuration to ignore g_return_*if_fail()/g_assert*()

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>
This commit is contained in:
Philip Withnall
2018-10-03 14:47:26 +01:00
parent 96c653265f
commit 8efe28c570
4 changed files with 20 additions and 7 deletions

View File

@@ -24,9 +24,9 @@ fedora-x86_64:
- meson ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build
- ninja -C _build
- mkdir -p _coverage
- lcov --rc lcov_branch_coverage=1 --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- meson test -C _build --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER}
- lcov --rc lcov_branch_coverage=1 --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always