From: Ulrich Drepper Date: Tue, 30 Aug 2005 01:22:01 +0000 (+0000) Subject: Add coverage analysis of test suite. X-Git-Tag: elfutils-0.120~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39cec7a022159c4d05867c3ca5d8f5c4df462d95;p=thirdparty%2Felfutils.git Add coverage analysis of test suite. --- diff --git a/ChangeLog b/ChangeLog index b390eedac..fc5cb13ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-29 Ulrich Drepper + + * configure.ac: Fix GCOV make condition generation. + 2005-08-28 Ulrich Drepper * configure.ac: Add --enable-gcov option. diff --git a/configure.ac b/configure.ac index f721310db..547d11823 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 e32c30418..ee6c18966 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2005-08-29 Ulrich Drepper + + * Makefile.am (EXTRA_DIST): Add coverage. + [GCOV]: Generate coverage summary after the tests ran + * coverage.sh: New file. + 2005-08-28 Ulrich Drepper * Makefile.an [BUILD_STATIC] (libdw): Add -ldl. diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ffe34ce9..119e11d79 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 000000000..d5fd6b63a --- /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