blob: da1b40f4a6b902c1e69c940f0752a36234130153 (
plain)
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
set -o nounset
set -o errexit
if [ "$#" -eq 0 ]; then
echo "Usage: coveragetool <outputdir> <inputs>..."
echo
echo "You may need to install perl-digest-MD5 for lcov"
echo " sudo yum install perl-Digest-MD5"
exit 1
fi
if ! which lcov; then
echo "lcov not installed"
exit 0
fi
gcov_out="$1"
shift
info=$gcov_out/gcov.info
html=$gcov_out/gcov.html
tracefiles=""
for i in $@; do
out=$gcov_out/$(basename "$i").info
tracefiles+=" --add-tracefile $out"
lcov --capture --quiet --directory "$i" --output-file "$out"
done
[ -n "$tracefiles" ] || return 0
lcov --quiet --output-file "$info" $tracefiles
genhtml --output-directory "$html" "$info"
echo
echo "LCOV report: file://$html/index.html"
|