fix automated coverage git-svn-id: svn://coreboot.org/openbios/fcode-utils@112 f158a5a8-5612-0410-a976-696ce0be7e32
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 51 52 53 54
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
+
+