blob: 5cc353c9ca4b45abf514400c7071525da6d70020 [file] [log] [blame]
Ulrich Drepper39cec7a2005-08-30 01:22:01 +00001#! /bin/bash
2
Roland McGrath994b4892005-12-05 22:46:21 +00003if [ "x$1" = "x-v" ]; then
4 verbose=yes
5else
6 verbose=no
7fi
8
Ulrich Drepper39cec7a2005-08-30 01:22:01 +00009cd ..
10
Roland McGrathe47ab762005-11-17 03:16:00 +000011for d in lib libasm libdw libdwfl libebl libelf backends src; do
Ulrich Drepper5a6f8d12005-08-30 17:56:53 +000012 tmp=$d-data
Ulrich Drepper39cec7a2005-08-30 01:22:01 +000013 cd $d
14 unused=0
Roland McGrath994b4892005-12-05 22:46:21 +000015 unused_files=
Ulrich Drepper39cec7a2005-08-30 01:22:01 +000016 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))
Roland McGrath994b4892005-12-05 22:46:21 +000025 unused_files="$unused_files $fc"
Ulrich Drepper39cec7a2005-08-30 01:22:01 +000026 fi
27 done
Ulrich Drepper5a6f8d12005-08-30 17:56:53 +000028 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
Roland McGrath994b4892005-12-05 22:46:21 +000034 if [ $verbose = yes ]; then
35 for f in $unused_files; do
36 printf '%-42s%s\n' '' $f
37 done
38 fi
Ulrich Drepper39cec7a2005-08-30 01:22:01 +000039 cd ..
40done