1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2025 Kohei Yoshida
#
# SPDX-License-Identifier: MIT
COVFILE="coverage.info"
PROGDIR=$(dirname $0)
TESTDIR=$(realpath "$PROGDIR/../test")
# Get the output directory from the user.
OUTDIR=$1
shift
if [ -z "$OUTDIR" ]; then
echo "Usage: $0 [output directory]"
exit 1
fi
mkdir -p "$OUTDIR"
cd "$OUTDIR"
lcov --capture --directory "$TESTDIR" -o $COVFILE || exit 1
genhtml $COVFILE -o html || exit 1
# View the reports in web browser.
xdg-open html/index.html
|