aboutsummaryrefslogtreecommitdiff
path: root/scripts/test/cov-diff
blob: 6179dff63e739dc6a9118abcb2f179e3718cf73e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Copyright 2013  The Tor Project, Inc.
# See LICENSE for licensing information.

# cov-diff -- compare two directories full of gcov files.

DIRA="$1"
DIRB="$2"

for B in $DIRB/*; do
  A=$DIRA/`basename $B`
  if [ -f $A ]; then
      perl -pe 's/^\s*\!*\d+(\*?):/        1$1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$A" > "$A.tmp"
  else
      cat /dev/null > "$A.tmp"
  fi
  perl -pe 's/^\s*\!*\d+(\*?):/        1$1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$B" > "$B.tmp"
  diff -u "$A.tmp" "$B.tmp" |perl -pe 's/^((?:\+\+\+|---)(?:.*tmp))\s+.*/$1/;'
  rm "$A.tmp" "$B.tmp"
done