Comments (2)
Patch from [email protected]
From 40946a6ad78cf79369676e65b3447b1ac14df2e9 Mon Sep 17 00:00:00 2001
From: Robert Rosengren <[email protected]>
Date: Tue, 30 Apr 2013 10:53:44 +0200
Subject: [PATCH 2/2] Multiple filter-options supported
---
scripts/gcovr | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/scripts/gcovr b/scripts/gcovr
index e375ffe..c7a7381 100755
Index: scripts/gcovr
===================================================================
--- a/scripts/gcovr
+++ b/scripts/gcovr
@@ -359,15 +359,21 @@
#
# Return if the filename does not match the filter
#
- if not options.filter.match(fname):
- if options.verbose:
- sys.stdout.write(" Filtering coverage data for file %s\n" % fname)
- return
+ filtered_fname = None
+ if len(options.filter) > 0:
+ for i in range(0,len(options.filter)):
+ if options.filter[i].match(fname):
+ filtered_fname = options.filter[i].sub('',fname)
+ break
+ if filtered_fname is None:
+ if options.verbose:
+ sys.stdout.write(" Filtering coverage data for file %s\n" % fname)
+ return
#
# Return if the filename matches the exclude pattern
#
for i in range(0,len(options.exclude)):
- if options.exclude[i].match(options.filter.sub('',fname)) or \
+ if (filtered_fname is not None and options.exclude[i].match(filtered_fname)) or \
options.exclude[i].match(fname) or \
options.exclude[i].match(os.path.abspath(fname)):
if options.verbose:
@@ -873,9 +879,9 @@
default=False)
parser.add_option("-f","--filter",
help="Keep only the data files that match this regular expression",
- action="store",
+ action="append",
dest="filter",
- default=None)
+ default=[])
parser.add_option("-e","--exclude",
help="Exclude data files that match this regular expression",
action="append",
@@ -945,10 +951,8 @@
#
for i in range(0,len(options.exclude)):
options.exclude[i] = re.compile(options.exclude[i])
-if options.filter is not None:
- options.filter = re.compile(options.filter)
-else:
- options.filter = re.compile('')
+for i in range(0,len(options.filter)):
+ options.filter[i] = re.compile(options.filter[i])
if options.root is not None:
if not options.root:
sys.stderr.write(
from gcovr.
Tests are passing with this merge, so I'm closing this ticket. Thanks!
from gcovr.
Related Issues (20)
- Compile Code and Collect Coverage Data on different machines HOT 5
- Large function lists break a browser HOT 1
- Add Per Function Branch Coverage Metric HOT 1
- An error about lambda was reported when executing gcovr HOT 6
- Exclude options are confusing HOT 2
- gcovr suggests --merge-mode-functions=MERGE_MODE even though it was invoked with --merge-mode-functions=merge-use-line-min HOT 1
- source file is newer than notes file HOT 3
- Add support to the Atlassian Clover output format HOT 17
- Decisions coverage is not printed in JSON summary HOT 3
- Update PyPi Frequency HOT 2
- `master` branch docs are out of date HOT 2
- Read configuration from `pyproject.toml` HOT 4
- UnknownLineType thrown when parsing coverage data from 10K+ line file HOT 3
- Unrecognized GCOV output in Debian Trixie HOT 1
- Gcovr fails with hyphen in path HOT 5
- Include multiple coverage reports in html with different coloring HOT 1
- pytest fails collecting with CC=x86_64-pc-linux-gnu-cc HOT 7
- Abnormal high line coverage on a function HOT 6
- "Unrecognized GCOV output" error when function tag line contains NAN
- Erroneous deprecation warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcovr.