Commit b2004ed6fd1e089a950f7f19cc457c6cf18f058b

Stefan Reinauer 2006-10-30T22:09:59

fix automated coverage git-svn-id: svn://coreboot.org/openbios/fcode-utils@112 f158a5a8-5612-0410-a976-696ce0be7e32

diff --git a/Makefile b/Makefile
index 16f65da..fc15860 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
 #
 
+VERSION:=$(shell grep ^\#.*TOKE_VERSION < toke/toke.c |cut -f2 -d\" )
+
 all:
 	make -C toke
 	make -C detok
@@ -51,6 +53,10 @@ tests: all
 	cp romheaders/romheaders testsuite
 	make -C testsuite all CygTestLogs=`pwd`/testlogs
 
+# lcov required for html reports
+coverage:
+	@testsuite/GenCoverage . fcode-suite-$(VERSION) "FCode suite $(VERSION)"
+	@testsuite/GenCoverage toke toke-$(VERSION) "Toke $(VERSION)"
 
 .PHONY: all clean distclean toke detok romheaders tests
 
diff --git a/testsuite/GenCoverage b/testsuite/GenCoverage
new file mode 100755
index 0000000..8d9da02
--- /dev/null
+++ b/testsuite/GenCoverage
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+SRCDIR=$1
+DSTDIR=$2
+BASENAME=$DSTDIR
+TITLE="$3"
+
+printf "Generating info file..."
+geninfo -t $BASENAME -o $BASENAME.info $SRCDIR 2>/dev/null
+printf "ok\n"
+
+printf "Filtering info file..."
+sed -i "/stat\.h/ {
+N
+N
+N
+N
+d
+}" $BASENAME.info
+printf "ok\n"
+
+genhtml --output-directory $DSTDIR --show-details --highlight --legend --frames --title "$TITLE" $BASENAME.info
+
+