windows port - regular expressions are not supported by mingw - replaced with glib...
[opensync.git] / tests / coverage.sh
blob22e7fc10ce46ddcde324c24c09dfc6f80333c22b
1 #!/bin/sh
3 echo -n "Checking Code Coverage of unit tests"
4 DATE=$( date +%Y%m%d%H%M%S )
6 if [ -d .svn ]; then
7 REV=`LANG=C svn info | grep Revision | cut -c 11-`
8 echo " for SVN Revision: $REV"
9 TITLE="OpenSync_SVN"$REV"_"$DATE
10 else
11 echo ":"
12 TITLE="OpenSync_"$DATE
13 fi
15 if ! [ -d coverage/html ]; then
16 mkdir -p coverage/html
19 echo $TITLE
20 lcov -t "$TITLE" -b ../ -d ../ -q -c -o coverage/$TITLE.info
21 genhtml --legend -t "$TITLE" -o coverage/html/$TITLE coverage/$TITLE.info &> /dev/null
23 cd coverage/html/
24 ln -sf $TITLE LATEST
25 cd ../../
27 # XXX: reset counters ( lcov -z seems to be outdated... tries to dlete .da files instead of .gcda )
28 find ../ -name "*.gcda" | xargs rm
30 echo -n "Code Coverage is: "
31 grep " %</td>" coverage/html/$TITLE/index.html | sed -e "s/^[^>]*>//g" -e "s/<[^>]*>//g"
32 echo -n ""
33 echo -e "\nTroubleshooting:\n If the Code Coverage number is quite low (less then 51%):"
34 echo -e "\t-Did you run any unit tests before $0?"
35 echo -e "\t-Did you build with enable_profiling=1?"
36 echo -e "\t-Run ALL available unit tests!"
37 echo -e "\t-Check if testcases in unit test are disabled!"
38 echo -e "\t-Fix unit tests and their test cases!"
39 echo -e "\t-Write new and more test cases!"
40 exit 0