~ubuntu-branches/ubuntu/quantal/elfutils/quantal

« back to all changes in this revision

Viewing changes to tests/coverage.sh

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2006-08-27 15:48:23 UTC
  • Revision ID: james.westby@ubuntu.com-20060827154823-mjwd7ydlbxgwqn4u
Tags: upstream-0.123
ImportĀ upstreamĀ versionĀ 0.123

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
if [ "x$1" = "x-v" ]; then
 
4
  verbose=yes
 
5
else
 
6
  verbose=no
 
7
fi
 
8
 
 
9
cd ..
 
10
 
 
11
for d in lib libasm libdw libdwfl libebl libelf backends src; do
 
12
  tmp=$d-data
 
13
  cd $d
 
14
  unused=0
 
15
  unused_files=
 
16
  for f in *.gcno; do
 
17
    base="$(basename $f .gcno)"
 
18
    fc="$base.c"
 
19
    gcda="$base.gcda"
 
20
    if [ -f "$gcda" ]; then
 
21
      gcov -n -a "$fc" |
 
22
      gawk "/$d.$fc/ { getline; co=gensub(/.*:(.*)% .*/, \"\\\\1\", \"g\"); co=co+0.0; li=\$4+0; printf \"%-35s  %6.2f %5d\n\", \"$d/$fc\", co, li } " >> $tmp
 
23
    else
 
24
      unused=$(($unused + 1))
 
25
      unused_files="$unused_files $fc"
 
26
    fi
 
27
  done
 
28
  if [ -f $tmp ]; then
 
29
    gawk "{ copct=\$2; co=(\$3*copct)/100; toco+=(co+0); toli += (\$3+0); } END { printf \"%-12s %6.2f%% covered       unused files: %3d\n\", \"$d\", (toco*100)/toli, \"$unused\" }" $tmp
 
30
    rm -f $tmp
 
31
  else
 
32
    printf "%-12s   0.00%% covered       unused files: %3d\n" "$d" $unused
 
33
  fi
 
34
  if [ $verbose = yes ]; then
 
35
    for f in $unused_files; do
 
36
      printf '%-42s%s\n' '' $f
 
37
    done
 
38
  fi
 
39
  cd ..
 
40
done