[glib: 1/2] CI: Include coverage data of code which isn't executed by the test suite.
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] CI: Include coverage data of code which isn't executed by the test suite.
- Date: Fri, 6 Jul 2018 12:30:05 +0000 (UTC)
commit 69ae2f424240f86c87a6756ae6e6a661d65b8cc7
Author: Christoph Reiter <reiter christoph gmail com>
Date: Fri Jul 6 09:33:22 2018 +0200
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.
.gitlab-ci.yml | 5 +++--
.gitlab-ci/coverage-docker.sh | 4 +++-
.gitlab-ci/test-msys2.sh | 29 +++++++++++++++++++----------
3 files changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e57122ece..8d1883d77 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,9 +21,10 @@ fedora-x86_64:
script:
- meson --buildtype debug --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build .
- ninja -C _build
- - meson test -C _build --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER}
- mkdir -p _coverage
- - lcov --rc lcov_branch_coverage=1 --directory . --capture --no-external --output-file
"_coverage/${CI_JOB_NAME}.lcov"
+ - lcov --rc lcov_branch_coverage=1 --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"
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
diff --git a/.gitlab-ci/coverage-docker.sh b/.gitlab-ci/coverage-docker.sh
index 49118d606..63e305147 100755
--- a/.gitlab-ci/coverage-docker.sh
+++ b/.gitlab-ci/coverage-docker.sh
@@ -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 \
diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh
index 20c79e763..b39a23db4 100755
--- a/.gitlab-ci/test-msys2.sh
+++ b/.gitlab-ci/test-msys2.sh
@@ -23,29 +23,38 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-toolchain \
mingw-w64-$MSYS2_ARCH-zlib
+curl -O -J -L "https://github.com/linux-test-project/lcov/releases/download/v1.13/lcov-1.13.tar.gz"
+echo "44972c878482cc06a05fe78eaa3645cbfcbad6634615c3309858b207965d8a23 lcov-1.13.tar.gz" | sha256sum -c
+tar -xzf lcov-1.13.tar.gz
+LCOV="$(pwd)/lcov-1.13/bin/lcov"
+
+mkdir -p _coverage
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
pip3 install --upgrade --user meson
export PATH="$HOME/.local/bin:$PATH"
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
+DIR="$(pwd)"
meson --werror --buildtype debug _build
cd _build
ninja
+"${LCOV}" \
+ --quiet \
+ --rc lcov_branch_coverage=1 \
+ --directory "${DIR}/_build" \
+ --capture \
+ --initial \
+ --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
+
# FIXME: fix the test suite
meson test --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} || true
-cd ..
-curl -O -J -L "https://github.com/linux-test-project/lcov/releases/download/v1.13/lcov-1.13.tar.gz"
-echo "44972c878482cc06a05fe78eaa3645cbfcbad6634615c3309858b207965d8a23 lcov-1.13.tar.gz" | sha256sum -c
-tar -xvzf lcov-1.13.tar.gz
-
-mkdir -p _coverage
-./lcov-1.13/bin/lcov \
+"${LCOV}" \
+ --quiet \
--rc lcov_branch_coverage=1 \
- --directory . \
+ --directory "${DIR}/_build" \
--capture \
- --no-external \
- --output-file "_coverage/${CI_JOB_NAME}.lcov"
+ --output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]