2015-05-12 06:06:49 -04:00
|
|
|
#!/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
|
2015-05-22 02:13:48 -04:00
|
|
|
_pb=''
|
|
|
|
if [ -n "$(which nproc)" ]; then
|
|
|
|
_pb="-j $(nproc)"
|
|
|
|
fi
|
2015-05-12 06:06:49 -04:00
|
|
|
|
|
|
|
rm -rf "$DESTDIR"
|
|
|
|
|
2015-05-14 18:46:31 -04:00
|
|
|
make distclean || :
|
2015-05-22 02:08:49 -04:00
|
|
|
./configure CFLAGS='-O0 -fprofile-arcs -ftest-coverage -fstack-protector-all'
|
2015-05-22 02:13:48 -04:00
|
|
|
make ${_pb} check
|
2015-05-12 06:06:49 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-05-14 18:46:31 -04:00
|
|
|
make distclean
|
|
|
|
|
2015-05-12 06:06:49 -04:00
|
|
|
echo "Coverage report available under $DESTDIR"
|