Merge branch 'maint-0.4.5' into maint-0.4.6
[tor.git] / scripts / test / cov-exclude
blob5cb9b1282d7e96e665bc289a229d21b6e318df10
1 #!/usr/bin/perl -p -i
3 use warnings;
4 use strict;
5 our $excluding;
7 # This script is meant to post-process a .gcov file for an input source
8 # that was annotated with LCOV_EXCL_START, LCOV_EXCL_STOP, and LCOV_EXCL_LINE
9 # entries. It doesn't understand the LCOV_EXCL_BR* variations.
11 # It replaces unreached reached lines with x:, and reached excluded lines
12 # with !!!num:.
14 BEGIN { our $excluding = 0; }
16 if (m/LCOV_EXCL_START/) {
17 $excluding = 1;
19 if ($excluding and m/LCOV_EXCL_STOP/) {
20 $excluding = 0;
23 my $exclude_this = (m/LCOV_EXCL_LINE/);
25 if ($excluding or $exclude_this) {
26 s{^\s*\#\#+:}{ x:};
27 s{^ (\s*)(\d+):}{$1!!!$2:};
30 if (eof and $excluding) {
31 warn "Runaway LCOV_EXCL_START in $ARGV";
32 $excluding = 0;