Replace lcov -r commands with faster way

Instead of using lcov -r (which is extremely slow), first use a python script to perform bulk cleanup of the /usr/include/* coverage. Then use lcov -a to remove the duplicate entries. This has the same effect of lcov -r but runs significantly faster
This commit is contained in:
Andrew Chow committed 2017-06-09 12:24:48 -07:00
1 parent c8914b9dbb
commit 405b86a92a
2 files changed
+32 -4

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#!/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', help='the pattern of files to remove')
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:
if line.startswith("SF:") and pattern in line:
in_remove = True
if not in_remove:
wf.write(line)
if line == 'end_of_record\n':
in_remove = False