]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a script to compare directories full of gcov output
authorNick Mathewson <nickm@torproject.org>
Tue, 9 Jul 2013 16:54:39 +0000 (12:54 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 10 Jul 2013 19:22:16 +0000 (15:22 -0400)
We can't just use "diff", since we don't care about changes in line
numbers, or changes in the exact number of times a line was called.
We just care about changes that make lines covered or non-coverd.  So
pre-process the files before calling diff.

contrib/cov-diff [new file with mode: 0755]

diff --git a/contrib/cov-diff b/contrib/cov-diff
new file mode 100755 (executable)
index 0000000..33a5480
--- /dev/null
@@ -0,0 +1,17 @@
+#!/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 A in $DIRA/*; do
+  B=$DIRB/`basename $A`
+  perl -pe 's/^\s*\d+:/        1:/; s/^([^:]+:)[\d\s]+:/$1/;' "$A" > "$A.tmp"
+  perl -pe 's/^\s*\d+:/        1:/; s/^([^:]+:)[\d\s]+:/$1/;' "$B" > "$B.tmp"
+  diff -u "$A.tmp" "$B.tmp"
+  rm "$A.tmp" "$B.tmp"
+done
+