Merge branch 'ci-coverage-include-baseline' into 'master'

CI: Include coverage data of code which isn't executed by the test suite.

See merge request GNOME/glib!152
This commit is contained in:
Philip Withnall 2018-07-06 12:28:52 +00:00
commit 7c8aaa7e0d
3 changed files with 25 additions and 13 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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==0.47.0
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"