summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2005-08-30 01:22:01 +0000
committerUlrich Drepper <[email protected]>2005-08-30 01:22:01 +0000
commit39cec7a022159c4d05867c3ca5d8f5c4df462d95 (patch)
tree1b43409cfefb7e68168dbe8135364dada2a52ef2
parentfbe998a0b1be1f006bc72e5138fb38c188cc0433 (diff)
Add coverage analysis of test suite.
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac2
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/Makefile.am10
-rwxr-xr-xtests/coverage.sh23
5 files changed, 43 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b390eeda..fc5cb13a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-29 Ulrich Drepper <[email protected]>
+
+ * configure.ac: Fix GCOV make condition generation.
+
2005-08-28 Ulrich Drepper <[email protected]>
* configure.ac: Add --enable-gcov option.
diff --git a/configure.ac b/configure.ac
index f721310d..547d1182 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,7 @@ if test "$use_gcov" = yes; then
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -fprofile-arcs"
fi
-AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
+AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
AM_CONDITIONAL(BUILD_STATIC, [dnl
test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
diff --git a/tests/ChangeLog b/tests/ChangeLog
index e32c3041..ee6c1896 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-29 Ulrich Drepper <[email protected]>
+
+ * Makefile.am (EXTRA_DIST): Add coverage.
+ [GCOV]: Generate coverage summary after the tests ran
+ * coverage.sh: New file.
+
2005-08-28 Ulrich Drepper <[email protected]>
* Makefile.an [BUILD_STATIC] (libdw): Add -ldl.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ffe34ce..119e11d7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -70,7 +70,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \
testfile20.bz2 testfile20.index.bz2 \
testfile21.bz2 testfile21.index.bz2 \
- testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2
+ testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \
+ coverage.sh
if MUDFLAP
static_build=yes
@@ -128,3 +129,10 @@ asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
CLEANFILES = xxx *.gcno *.gcda *gconv
+
+if GCOV
+check: check-am coverage
+.PHONY: coverage
+coverage:
+ -$(srcdir)/coverage.sh
+endif
diff --git a/tests/coverage.sh b/tests/coverage.sh
new file mode 100755
index 00000000..d5fd6b63
--- /dev/null
+++ b/tests/coverage.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+cd ..
+
+for d in lib libasm libdw libdwfl libebl libelf src; do
+ tmp=../$d-data
+ cd $d
+ unused=0
+ for f in *.gcno; do
+ base="$(basename $f .gcno)"
+ fc="$base.c"
+ gcda="$base.gcda"
+ if [ -f "$gcda" ]; then
+ gcov -n -a "$fc" |
+ gawk "/$d.$fc/ { getline; co=gensub(/.*:(.*)% .*/, \"\\\\1\", \"g\"); co=co+0.0; li=\$4+0; printf \"%-35s %6.2f %5d\n\", \"$d/$fc\", co, li } " >> $tmp
+ else
+ unused=$(($unused + 1))
+ fi
+ done
+ gawk "{ copct=\$2; co=(\$3*copct)/100; toco+=(co+0); toli += (\$3+0); } END { printf \"%-12s %6.2f%% covered unused files: %3d\n\", \"$d\", (toco*100)/toli, \"$unused\" }" $tmp
+ rm -f $tmp
+ cd ..
+done