blob: 956b2d152a0b0f739c96d96f1e091e73928c5731 [file] [log] [blame]
Roger Meier213a6642010-10-27 12:30:11 +00001# /bin/sh
2
3command="$0"
4
5stripcommand=`echo "$command" | sed 's/testwrapper-//'`
6
7"$stripcommand" "$@" || exit $?
8
9if test "x@ENABLE_COVERAGE@" = "x1"; then
10 # linux: 97.67% of 86 lines executed in file ../src/test123.h
11 # bsd: 100.00% of 196 source lines executed in file testbimap.c
12
13 extrastripcommand=`echo "$stripcommand" | sed 's/\.\///'`
14 ${GCOV:-gcov} "$extrastripcommand" 2>&1 \
15 | perl -ne 'BEGIN { $file = undef; }
16 next if m!^Creating!;
17 next if m!creating!;
18 next if m!^$!;
19 next if m!not exhausted!;
20 next if m!^Unexpected EOF!;
21 if (m!([\d\.]+)\% of \d+( source)? lines executed in file (.+)!)
22 {
23 do
24 {
25 if ( $3 !~ m#^/# )
26 {
27 $a = $3 =~ m%([\-\w\.]+)$%;
28 print STDERR $_;
29 print "$1.gcov\n";
30 }
31 } if $1 < 110.0;
32 }
33 elsif (m#^File .(.*?).$#)
34 {
35 $file = $1;
36 }
37 elsif (m#Lines executed:([\d\.]+)\% of (\d+)#)
38 {
39 $percent = $1;
40 $lines = $2;
41 do
42 {
43 if ( $file !~ m#^/# )
44 {
45 $a = $file =~ m%([\-\w\.]+)$%;
46 print STDERR "$percent% of $lines executed in file $file\n";
47 print "$1.gcov\n";
48 }
49 } if $percent < 110.0;
50 }
51 else
52 {
53 print
54 }' \
55 | xargs grep -n -A2 -B2 '#####.*\w'
56 exit 0
57fi
58