• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/bash
2
3if [ "x$1" = "x-v" ]; then
4  verbose=yes
5else
6  verbose=no
7fi
8
9cd ..
10
11for 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 ..
40done
41