-
Notifications
You must be signed in to change notification settings - Fork 31
/
coverage.sh
executable file
·50 lines (37 loc) · 1.26 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
#!/bin/sh
set -e -u -x
# needs 'gcov' executable and gcovr script installed
# as well https://github.com/gcovr/gcovr
gcovr --version
REV="${1:-HEAD}"
TDIR=`mktemp -d`
trap 'rm -rf "$TDIR"' EXIT INT QUIT TERM
git archive --format tar "$REV" | tar -C "$TDIR" -xv
if [ -f configure/RELEASE.local ]
then
sed -e "s|\$(TOP)|${PWD}|g" configure/RELEASE.local > "$TDIR/configure"/RELEASE.local
else
sed -e "s|\$(TOP)|${PWD}|g" configure/RELEASE > "$TDIR/configure"/RELEASE.local
fi
if [ -f configure/CONFIG_SITE.local ]
then
sed -e 's|-Werror||g' configure/CONFIG_SITE.local > "$TDIR/configure"/CONFIG_SITE.local
fi
make -C "$TDIR" -j8 \
CROSS_COMPILER_TARGET_ARCHS= \
CMD_CXXFLAGS='-fprofile-arcs -ftest-coverage -O0' \
CMD_LDFLAGS='-fprofile-arcs -ftest-coverage' \
test
make -C "$TDIR" -j8 \
CROSS_COMPILER_TARGET_ARCHS= \
CMD_CXXFLAGS='-fprofile-arcs -ftest-coverage -O0' \
CMD_LDFLAGS='-fprofile-arcs -ftest-coverage' \
runtests
OUTDIR="$PWD"/coverage
install -d "$OUTDIR"
cd "$TDIR"/src/O.linux-*
gcovr --gcov-ignore-parse-errors -v -r .. --html --html-details -o "$OUTDIR"/coverage.html
cd "$TDIR"/ioc/O.linux-*
gcovr --gcov-ignore-parse-errors -v -r .. --html --html-details -o "$OUTDIR"/coverage-ioc.html
cd "$OUTDIR"
tar -cavf coverage.tar.bz2 coverage*.html