rbb 2004/03/10 11:36:38
Modified: build run-gcov.sh
Log:
Add percent tested to the output of the coverage script. Also
colorize the page based on the percent tested.
Revision Changes Path
1.4 +25 -8 apr/build/run-gcov.sh
Index: run-gcov.sh
===================================================================
RCS file: /home/cvs/apr/build/run-gcov.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- run-gcov.sh 10 Mar 2004 02:44:27 -0000 1.3
+++ run-gcov.sh 10 Mar 2004 19:36:38 -0000 1.4
@@ -5,10 +5,6 @@
fi
cd coverage
-for i in `find .. -name "*.bb" -maxdepth 1`; do
- gcov $i -o ..
-done
-
# It would be really nice to find a better way to do this than copying the
# HTML into this script. But, I am being lazy right now.
cat > index.html << EOF
@@ -86,14 +82,35 @@
but all tests should be moving to the unified framework, so this is
correct.</p>
</blockquote>
+ <table border="0" width="100%" cellspacing="4">
EOF
-for i in `find . -name "*.gcov" -print`; do
+for i in `find .. -name "*.bb" -maxdepth 1`; do
+ percent=`gcov $i -o .. | grep "%" | awk -F'%' {'print $1'}`
name=`echo $i | awk -F'/' {'print $2'}`
- echo " <a href=\"$name\">$name</a><br>" >> index.html
-done;
+ basename=`echo $name | awk -F'.' {'print $1'}`
+
+ if [ "x$percent" = "x" ]; then
+ echo "<tr>" >> index.html
+ echo "<td bgcolor=#ffffff> Error generating data for $basename<br>"
>> index.html
+ continue;
+ fi
+ intpercent=`echo "$percent/1" | bc`
+ if [ $intpercent -lt 33 ]; then
+ color="#ffaaaa"
+ else if [ $intpercent -lt 66 ]; then
+ color="#ffff77"
+ else
+ color="#aaffaa"
+ fi
+ fi
+
+ echo "<tr>" >> index.html
+ echo "<td bgcolor=$color><a href=\"$basename.c.gcov\">$basename</a><br>"
>> index.html
+ echo "<td bgcolor=$color>$percent% tested" >> index.html
+done
-echo "<p>Last generated `date`</p>" >> index.html
+echo "</table><p>Last generated `date`</p>" >> index.html
cat >> index.html << EOF
</td></tr>