forked from wolfSSL/wolfEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage.sh
executable file
·52 lines (42 loc) · 1.25 KB
/
coverage.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Creates the coverage output for the library.
# Runs the tests for the current configuration.
# Must be run on Linux and have lcov installed.
# The configuration must have used --enable-coverage.
#
WOLFENGINE_PATH=`realpath $0`
WOLFENGINE_PATH=`dirname $WOLFENGINE_PATH`
COVERAGE_HTML=../coverage
COVERAGE_INFO=../coverage.info
export WOLFENGINE_OPENSSL_TEST=y
which lcov >/dev/null 2>&1
LCOV=$?
which genhtml >/dev/null 2>&1
GENHTML=$?
if [ $LCOV -ne 0 -o $GENHTML -ne 0 ]; then
echo 'Please install lcov on this system.'
echo
return 1
fi
grep -- '--enable-coverage' config.status >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo 'Not configured for coverage!'
echo
echo 'Configure with option:\n --enable-coverage'
echo
return 1
fi
if [ ! -d "$COVERAGE_HTML" ]; then
mkdir $COVERAGE_HTML
fi
make clean
find . -name '*.gcda' | xargs rm -f
find . -name '*.gcno' | xargs rm -f
make test
lcov --rc lcov_branch_coverage=1 --capture --list-full-path --directory src --directory include --output-file $COVERAGE_INFO
genhtml --rc lcov_branch_coverage=1 --prefix $WOLFENGINE_PATH --branch-coverage $COVERAGE_INFO --output-directory $COVERAGE_HTML
OUTDIR=`readlink -m $PWD/$COVERAGE_HTML`
echo
echo 'Coverage results:'
echo " $OUTDIR/index.html"
echo