Commit 5f9402bb authored by Pekka Pessi's avatar Pekka Pessi

Including all input files in output.

darcs-hash:20051005071405-65a35-35be545b47bf68dad2c13f851948dc2f7eccbf08.gz
parent 5197c0b1
......@@ -2,19 +2,22 @@
#
# Calculate coverage of source files
#
# $Id: coverage,v 1.1 2005/10/03 22:59:22 ppessi Exp $
#
{
for f
for f in *.bb
do
test "$f" = "*.bb" && { echo "run 'make check' first"; exit 1; }
gcov -n "$f" 2>/dev/null
done
for f in $@
do
case "$f" in
*.c ) gcov -n "$f" 2>/dev/null ;;
esac
gcov -n "$f" 2>/dev/null
done
} |
awk '
BEGIN { i=1; }
BEGIN {
'"$(for f in "$@"; do echo 'include["'$f'"] = 1;'; done)"'
}
/^File/ {
if (sub(/^File `\/home\/ppessi\/sofia-proxy\/(proxy\/..\/)?/, "")) {
......@@ -25,7 +28,7 @@ BEGIN { i=1; }
else
file = "";
}
file ~ /\.c$/ && /Lines executed/ {
file ~ /\.[hc]$/ && /Lines executed/ {
sub(/Lines executed:/, "");
covered = int($3*$1/100 + 0.5);
......@@ -43,31 +46,35 @@ file ~ /\.c$/ && /Lines executed/ {
}
}
/torture/ { next; } /test/ { next; }
/torture/ { next; }
/test/ { next; }
/\/usr\/include/ { next; }
/(source )?lines executed in file (.*\/)?[-A-Za-z_0-9]+\.[ch]/ {
file = $0;
sub(/ in file /, "", file);
sub(/.*\//, "", file);
covered = int($3*$1/100 + 0.5);
#printf "%-5u %-5u %-5u %-7s %s\n", $3, covered, $3 - covered, $1, file;
/source lines executed in file [-A-Za-z_0-9]+\.c/ {
file = $9;
sub(/lines executed/, "");
# covered = int($3*$1/100 + 0.5);
# printf "%-5u %-5u %-5u %-7s %s\n", $3, covered, $3 - covered, $1, file;
if ($3 == 0) {
/* skip */
}
else if (!lines[file]) {
names[i++] = file;
else if (!file in lines) {
lines[file] = $3; coverage[file] = $3*$1/100;
}
else if (coverage[file] < covered) {
else if (coverage[file] <= $3*$1/100) {
lines[file] = $3; coverage[file] = $3*$1/100;
}
}
END {
for (j=1; j < i; j++) {
file = names[j];
for (file in lines) {
if (!(file in include))
continue;
l = lines[file]; c = coverage[file];
covered = int(c + 0.5);
total += l; total_coverage += c;
total += l; total_coverage += c;
printf "%-5u %-5u %-5u %6.2f%% %s\n",
l, covered, l - covered, 100.0 * c / l, file;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment