forked from PIVX-Project/PIVX
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Update coverage build target(s)
- Loading branch information
Showing
3 changed files
with
64 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', encoding="utf8") as f: | ||
with open(outfile, 'w', encoding="utf8") 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 |