Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 1 | # /bin/sh |
| 2 | |
| 3 | command="$0" |
| 4 | |
| 5 | stripcommand=`echo "$command" | sed 's/testwrapper-//'` |
| 6 | |
| 7 | "$stripcommand" "$@" || exit $? |
| 8 | |
| 9 | if 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 |
| 57 | fi |
| 58 | |