mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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.
This commit is contained in:
parent
c5321810f4
commit
69ae2f4242
@ -21,9 +21,10 @@ fedora-x86_64:
|
|||||||
script:
|
script:
|
||||||
- meson --buildtype debug --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build .
|
- meson --buildtype debug --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build .
|
||||||
- ninja -C _build
|
- ninja -C _build
|
||||||
- meson test -C _build --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER}
|
|
||||||
- mkdir -p _coverage
|
- 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:
|
artifacts:
|
||||||
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||||
when: always
|
when: always
|
||||||
|
@ -5,9 +5,11 @@ set -e
|
|||||||
# Fixup Windows paths
|
# Fixup Windows paths
|
||||||
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
|
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
|
||||||
|
|
||||||
# Remove coverage from generated code in the build directory
|
|
||||||
for path in _coverage/*.lcov; do
|
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}"
|
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
|
done
|
||||||
|
|
||||||
genhtml \
|
genhtml \
|
||||||
|
@ -23,29 +23,38 @@ pacman --noconfirm -S --needed \
|
|||||||
mingw-w64-$MSYS2_ARCH-toolchain \
|
mingw-w64-$MSYS2_ARCH-toolchain \
|
||||||
mingw-w64-$MSYS2_ARCH-zlib
|
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
|
mkdir -p _ccache
|
||||||
export CCACHE_BASEDIR="$(pwd)"
|
export CCACHE_BASEDIR="$(pwd)"
|
||||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||||
pip3 install --upgrade --user meson
|
pip3 install --upgrade --user meson
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
|
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
|
||||||
|
DIR="$(pwd)"
|
||||||
|
|
||||||
meson --werror --buildtype debug _build
|
meson --werror --buildtype debug _build
|
||||||
cd _build
|
cd _build
|
||||||
ninja
|
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
|
# FIXME: fix the test suite
|
||||||
meson test --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} || true
|
meson test --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} || true
|
||||||
|
|
||||||
cd ..
|
"${LCOV}" \
|
||||||
curl -O -J -L "https://github.com/linux-test-project/lcov/releases/download/v1.13/lcov-1.13.tar.gz"
|
--quiet \
|
||||||
echo "44972c878482cc06a05fe78eaa3645cbfcbad6634615c3309858b207965d8a23 lcov-1.13.tar.gz" | sha256sum -c
|
|
||||||
tar -xvzf lcov-1.13.tar.gz
|
|
||||||
|
|
||||||
mkdir -p _coverage
|
|
||||||
./lcov-1.13/bin/lcov \
|
|
||||||
--rc lcov_branch_coverage=1 \
|
--rc lcov_branch_coverage=1 \
|
||||||
--directory . \
|
--directory "${DIR}/_build" \
|
||||||
--capture \
|
--capture \
|
||||||
--no-external \
|
--output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov"
|
||||||
--output-file "_coverage/${CI_JOB_NAME}.lcov"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user