]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/build-coverage.sh
Merge with master
[lilypond.git] / buildscripts / build-coverage.sh
1 #!/bin/sh
2
3 if test "$1" == "--fresh"; then
4   fresh=yes
5 fi
6
7 if test ! -f config-cov.make; then
8   fresh=yes
9 fi
10
11 if test "$fresh" = "yes";
12 then
13   ./configure --enable-config=cov --disable-optimising \
14    &&   make conf=cov -j2 clean \
15    &&   perl -i~ -pe 's/-pipe /-fprofile-arcs -ftest-coverage -pipe /g' config-cov.make \
16    &&   perl -i~ -pe 's/ -ldl / -lgcov -ldl /g' config-cov.make
17 else
18   find -name '*.gcda' -exec rm  '{}' ';'
19 fi
20
21 mkdir -p scripts/out-cov/
22 touch  scripts/out-cov/midi2ly.1
23 make conf=cov -j2 &&  \
24   make conf=cov test-clean OUT_TEST=testcov LILYPOND_JOBS= && \
25   make conf=cov test OUT_TEST=testcov LILYPOND_JOBS= 
26
27 if test "$?" != "0"; then
28   tail -100 out-cov/test-run.log
29   exit 1
30 fi
31
32 depth=../..
33 resultdir=out/coverage-results
34
35 rm -rf $resultdir
36 mkdir $resultdir
37 cd $resultdir
38
39 ln $depth/lily/* .
40 ln $depth/lily/out-cov/*[ch] .
41 mkdir include
42 ln $depth/lily/include/* include/
43 ln $depth/flower/include/* include/
44 for a in *[cl] *.yy
45 do
46    gcov -o $depth/lily/out-cov/  -p $a > $a.gcov-summary
47 done 
48
49 python $depth/buildscripts/coverage.py --uncovered *.cc > uncovered.txt
50 python $depth/buildscripts/coverage.py --hotspots *.cc > hotspots.txt
51 python $depth/buildscripts/coverage.py --summary *.cc > summary.txt
52
53 head -20 summary.txt
54
55 cat <<EOF
56 results in
57
58   out/coverage-results/summary.txt
59   out/coverage-results/uncovered.txt
60   out/coverage-results/hotspots.txt
61
62 EOF