1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00
ezstream/gen-coverage-report.sh
2020-01-22 22:55:27 +01:00

45 lines
909 B
Bash
Executable File

#!/bin/sh
PROGRAM="ezstream"
set -e
trap '' 1
trap 'exit 1' 2 15
BUILD_DATE=$(date '+%Y%m%d')
DESTDIR=$PROGRAM-coverage-$BUILD_DATE
if [ -z "$(which lcov)" ]; then
echo "lcov is required" >&2
exit 1
fi
if [ -z "$(which genhtml)" ]; then
echo "genhtml is required" >&2
exit 1
fi
_pb=''
if [ -n "$(which nproc)" ]; then
_pb="-j $(nproc)"
fi
rm -rf "$DESTDIR"
make distclean || :
./configure CFLAGS='-O0 -fprofile-arcs -ftest-coverage -fstack-protector-all' $*
make ${_pb} check
mkdir -p $DESTDIR
lcov --capture --output-file $DESTDIR/coverage.tmp \
--rc lcov_branch_coverage=1 \
--directory src \
--test-name "Ezstream $VERSION"
genhtml --prefix . --output-directory $DESTDIR \
--branch-coverage --function-coverage \
--rc lcov_branch_coverage=1 \
--title "Ezstream $VERSION" --legend --show-detail $DESTDIR/coverage.tmp
make distclean
echo "Coverage report available under $DESTDIR"