-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcov
executable file
·39 lines (33 loc) · 1.1 KB
/
cov
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
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
DIST_ARCHIVES="$1"
which lcov 1>/dev/null 2>&1
if [ $? != 0 ]; then
echo "$(basename $0) error: lcov: missing tool" 1>&2
exit 1
fi
#if [ ! $DIST_ARCHIVES ]; then
# echo "$(basename $0) error: $DIST_ARCHIVES: missing archive" 1>&2
# exit 1
#fi
set -x
#tar zxf $DIST_ARCHIVES
#srcdir=${DIST_ARCHIVES/.tar.gz}
#cd $srcdir
# Reconfigure with gcov support
LCOV="lcov --rc lcov_branch_coverage=1"
[ "x$GCOV" != "x" ] && LCOV="${LCOV} --gcov-tool $(which ${GCOV})"
# Generate gcov output
CFLAGS="-g -O0 --coverage" ./configure
make clean
make
$LCOV --base-directory . --directory . --zerocounters -q
make check
# Generate html report
$LCOV --base-directory . --directory . -c -o zedhat_test.info
$LCOV --remove zedhat_test.info "/usr*" -o zedhat_test.info # remove output for external libraries
#rm -rf test_coverage
$LCOV --remove zedhat_test.info "*/tests/*" -o zedhat_test.info # remove test code
genhtml -o test_coverage --rc lcov_branch_coverage=1 -t "zedhat test coverage" --num-spaces 4 zedhat_test.info
# Clean work space
#cd .. && rm -rf $srcdir
echo "xdg-open ./test_coverage/index.html"