Skip to content

Commit

Permalink
chore(tools/generate-coverage): enable ccache
Browse files Browse the repository at this point in the history
Signed-off-by: black-desk <me@black-desk.cn>
  • Loading branch information
black-desk committed Oct 14, 2023
1 parent 64570e1 commit 7b360ba
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tools/generate-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
# SPDX-License-Identifier: LGPL-3.0-or-later

set -x
set -e

cd "$(git rev-parse --show-toplevel)" || exit 255

tmpdir=$(
mktemp -d build-generate-coverage-XXXXXX || exit 255
)
builddir=build-generate-coverage

export CXXFLAGS="$CXXFLAGS --coverage -g -O0"

cmake -B "$tmpdir" -S . || exit 255
command -v ccache &>/dev/null && {
USE_CCACHE=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
}

cmake --build "$tmpdir" -j "$(nproc)" || exit 255
# shellcheck disable=SC2086
cmake --fresh -B "$builddir" -S . $USE_CCACHE || exit 255

cmake --build "$tmpdir" -t test
cmake --build "$builddir" -j "$(nproc)" || exit 255

mkdir "$tmpdir"/report || exit 255
cmake --build "$builddir" -t test

gcovr --filter "src/*" --html-nested "$tmpdir"/report/index.html
mkdir -p "$builddir"/report || exit 255

gcovr --filter "src/*" --html-nested "$builddir"/report/index.html

0 comments on commit 7b360ba

Please sign in to comment.