#!/bin/sh
-./configure --enable-config=cov --disable-optimising
-make conf=cov -j2 clean
-perl -i~ -pe 's/-pipe /-fprofile-arcs -ftest-coverage -pipe /g' config-cov.make
-perl -i~ -pe 's/ -ldl / -lgcov -ldl /g' config-cov.make
+
+if test "$1" == "--fresh"; then
+ fresh=yes
+fi
+
+if test ! -f config-cov.make; then
+ fresh=yes
+fi
+
+if test "$fresh" = "yes";
+then
+ ./configure --enable-config=cov --disable-optimising
+ make conf=cov -j2 clean
+ perl -i~ -pe 's/-pipe /-fprofile-arcs -ftest-coverage -pipe /g' config-cov.make
+ perl -i~ -pe 's/ -ldl / -lgcov -ldl /g' config-cov.make
+else
+ find -name '*.gcda' -exec rm '{}' ';'
+fi
+
+
make conf=cov -j2
make conf=cov test-clean LILYPOND_JOBS=
make conf=cov test LILYPOND_JOBS= >& out-cov/test-run.log
+rm -rf out-cov
+mkdir out-cov
+
cd out-cov
ln ../lily/* .
ln ../lily/out-cov/*[ch] .
do
gcov -o ../lily/out-cov/ -p $a > $a.gcov-summary
done
+
+python buildscripts/coverage.py
results.sort ()
results.reverse()
+
+print 'files sorted by number of untested lines (decreasing)'
+print
+print '%5s (%6s): %s' % ('cov %', 'lines', 'file')
+print '----------------------------------------------'
+
for (pain, d) in results:
print '%(cov)5.2f (%(lines)6d): %(file)s' % d