diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-06-22 20:49:54 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-06-22 20:57:11 +0200 |
commit | 8c2098ad120913776421bf670aadf69b01c534bf (patch) | |
tree | c91e5e6109c15dd6baf40a02f5425fe6c78fc9ba /contrib | |
parent | 6bef7ca8bc6a0894875eede7cbb2f28e77e91bd7 (diff) | |
parent | d5711f4a2d59adc45755b13e3776b9d36e1c55f5 (diff) |
Merge #10565: [coverage] Remove subtrees and benchmarks from coverage report
d5711f4 Filter subtrees and and benchmarks from coverage report (Andrew Chow)
405b86a Replace lcov -r commands with faster way (Andrew Chow)
c8914b9 Have `make cov` optionally include branch coverage statistics (Andrew Chow)
Tree-SHA512: 9c349a7baeb7430ea586617c52f91177df58e3546d6dc573e26815ddb79e30ab1873542d85ac1daca5e1fb2c6d6c8965824b42d027b6b0496a744af57b095852
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/filter-lcov.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/filter-lcov.py b/contrib/filter-lcov.py new file mode 100755 index 0000000000..299377d691 --- /dev/null +++ b/contrib/filter-lcov.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import argparse + +parser = argparse.ArgumentParser(description='Remove the coverage data from a tracefile for all files matching the pattern.') +parser.add_argument('--pattern', '-p', action='append', help='the pattern of files to remove', required=True) +parser.add_argument('tracefile', help='the tracefile to remove the coverage data from') +parser.add_argument('outfile', help='filename for the output to be written to') + +args = parser.parse_args() +tracefile = args.tracefile +pattern = args.pattern +outfile = args.outfile + +in_remove = False +with open(tracefile, 'r') as f: + with open(outfile, 'w') as wf: + for line in f: + for p in pattern: + if line.startswith("SF:") and p in line: + in_remove = True + if not in_remove: + wf.write(line) + if line == 'end_of_record\n': + in_remove = False |