summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2007-11-11 20:08:02 -0500
committerDavid Zeuthen <davidz@redhat.com>2007-11-11 20:08:02 -0500
commit4b340f87709d93904eb4868384b555227e656317 (patch)
treec904928bfc5da04e0babda6816e8e4128bfcd3f9 /test
parent20fa8e0d76bb34712c7854179ff305d7eedab5c1 (diff)
downloadpolkit-4b340f87709d93904eb4868384b555227e656317.tar.gz
add unit test framework to the rest of the library sources
Diffstat (limited to 'test')
-rwxr-xr-xtest/create-coverage-report.sh38
1 files changed, 22 insertions, 16 deletions
diff --git a/test/create-coverage-report.sh b/test/create-coverage-report.sh
index cb14a1e..68ce8f6 100755
--- a/test/create-coverage-report.sh
+++ b/test/create-coverage-report.sh
@@ -16,35 +16,41 @@ echo "==========================================================================
while [ $# -gt 0 ] ; do
SOURCE=`cat $P/$1 |wc -l`
- ACTUAL=`grep -v " -:" $P/$1.gcov |wc -l`
- NOT_COVERED=`grep " #####:" $P/$1.gcov |wc -l`
- COVERED=$(($ACTUAL - $NOT_COVERED))
- PERCENT=$((100 * $COVERED / $ACTUAL))
-
TOTAL_SOURCE=$(($TOTAL_SOURCE + $SOURCE))
- TOTAL_ACTUAL=$(($TOTAL_ACTUAL + $ACTUAL))
- TOTAL_COVERED=$(($TOTAL_COVERED + $COVERED))
echo -n "$1"
-
+
n=${#1}
while [ $n -lt 55 ] ; do
echo -n " "
n=$(($n + 1))
done
-
+
echo -n " : "
- if [ $PERCENT -lt 10 ] ; then
- echo -n " $PERCENT%"
- elif [ $PERCENT -lt 100 ] ; then
- echo -n " $PERCENT%"
+ if [ -e $P/$1.gcov ] ; then
+ ACTUAL=`grep -v " -:" $P/$1.gcov |wc -l`
+ NOT_COVERED=`grep " #####:" $P/$1.gcov |wc -l`
+ COVERED=$(($ACTUAL - $NOT_COVERED))
+ PERCENT=$((100 * $COVERED / $ACTUAL))
+
+ TOTAL_ACTUAL=$(($TOTAL_ACTUAL + $ACTUAL))
+ TOTAL_COVERED=$(($TOTAL_COVERED + $COVERED))
+
+ if [ $PERCENT -lt 10 ] ; then
+ echo -n " $PERCENT%"
+ elif [ $PERCENT -lt 100 ] ; then
+ echo -n " $PERCENT%"
+ else
+ echo -n "100%"
+ fi
+
+ echo " ($COVERED of $ACTUAL)"
+
else
- echo -n "100%"
+ echo " 0% (not tested)"
fi
- echo " ($COVERED of $ACTUAL)"
-
shift
done