Implemented long variable names a la spss V12.
[pspp-builds.git] / tests / coverage.sh
1 #!/bin/sh
2
3 # This little script can be used in conjunction with gcov to see how well 
4 # the regression test suite is covering the PSPP code.
5
6 # To use it: 
7
8 # make distclean
9 # export CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
10 # ./configure
11 # make check
12 # tests/coverage.sh
13
14 export TEMPDIR=/tmp/pspp-cov-$$
15
16 mkdir -p $TEMPDIR
17
18 files=`find src -name '*.c'`
19
20 export summary_file="$TEMPDIR/coverage.txt"
21
22 rm -f $summary_file
23
24 for f in $files ; do 
25         dir=`dirname $f`
26         gcov -p -l -n -o $dir $f  | grep -v '^Creat' >> $summary_file
27 done
28
29 cat  > "$TEMPDIR/cov.sps" << EOF 
30 DATA LIST  FREE  FILE='$summary_file' /COVERAGE (PCT8) d1 (a2) lines *  d2 (a10) d3 (a10) d4 (a10) d5 (a10) file (a25).
31
32
33 AGGREGATE OUTFILE=*
34         /BREAK=file
35         /COVERAGE=MIN(COVERAGE).
36
37 SORT CASES BY COVERAGE.
38
39 LIST /COVERAGE file.
40
41 FREQUENCIES /COVERAGE
42   /HISTOGRAM
43   /PERCENTILES=25,50,75,90.
44
45 EOF
46
47 src/pspp -o html $TEMPDIR/cov.sps
48
49 rm -rf $TEMPDIR