tor/scripts/test/cov-diff
Nick Mathewson 4043f2c95f Adopt the LCOV convention for marking lines as unreachable by tests.
Document this convention.

Add a script to post-process .gcov files in order to stop nagging us
about excluded lines.

Teach cov-diff to handle these post-processed files.

Closes ticket 16792
2016-04-12 21:12:10 -04:00

18 lines
494 B
Bash
Executable File

#!/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/; s/^ *-:(Runs|Programs):.*//;' "$A" > "$A.tmp"
perl -pe 's/^\s*\!*\d+:/ 1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$B" > "$B.tmp"
diff -u "$A.tmp" "$B.tmp"
rm "$A.tmp" "$B.tmp"
done