From 405b86a92aee4f2ddb6710bfe07ff714f2afcfa2 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Tue, 6 Jun 2017 17:26:56 -0700 Subject: 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 --- contrib/filter-lcov.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 contrib/filter-lcov.py (limited to 'contrib/filter-lcov.py') diff --git a/contrib/filter-lcov.py b/contrib/filter-lcov.py new file mode 100755 index 0000000000..ce2966c43d --- /dev/null +++ b/contrib/filter-lcov.py @@ -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 -- cgit v1.2.3 From d5711f4a2d59adc45755b13e3776b9d36e1c55f5 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 8 Jun 2017 18:15:55 -0700 Subject: Filter subtrees and and benchmarks from coverage report Remove leveldb baseline coverage gathering. Added filter rules to remove all of the subtress (leveldb, secp256k1, ctaes, univalue) and benchmarking from the coverage report. These items are unnecessary as we do not test for any of the subtrees and benchmark coverage is unneeded. --- contrib/filter-lcov.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'contrib/filter-lcov.py') diff --git a/contrib/filter-lcov.py b/contrib/filter-lcov.py index ce2966c43d..299377d691 100755 --- a/contrib/filter-lcov.py +++ b/contrib/filter-lcov.py @@ -3,7 +3,7 @@ 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('--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') @@ -16,8 +16,9 @@ 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 + 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': -- cgit v1.2.3