-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclusion Patterns for Lines and Branches #416
Conversation
Adds line and branch exclusion, following the names of the vars in lcovrc. The lines are removed during path rewriting (as the full path is resolved during this phase). Dangling regions are permitted for e.g. `mod tests {`
Codecov Report
@@ Coverage Diff @@
## master #416 +/- ##
==========================================
+ Coverage 68.66% 69.63% +0.96%
==========================================
Files 12 13 +1
Lines 4340 4521 +181
Branches 977 1009 +32
==========================================
+ Hits 2980 3148 +168
+ Misses 604 591 -13
- Partials 756 782 +26
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an interesting patch (thanks for doing it)
Would it be possible to multi-thread the filter part ?
Use new functionality to exclude `#[derive(` from bootstrapped codecov checks.
Thanks for all the great feedback!
I had a go at it using Rayon, adding inline comments in a few moments. |
FYI: TravisCI doesn't seem to be reporting back on successful builds: https://travis-ci.org/github/mozilla/grcov/builds/670724791 |
I'm new to Could you suggest how this would best be used? For example, what would be a good method of ignoring It looks like the This patch looks like it's generic without suggesting a similar default implementation. Would including the ref: https://stackoverflow.com/questions/3555083/how-do-i-tell-gcov-to-ignore-un-hittable-lines-of-c-code And, thanks for the patch! |
Always a pleasure!
In some projects, tests are contained in different directories entirely - those projects already have usable ignores in grcov (just ignore the entire file with the existing file exclusion patterns). The other approach that seems widespread in Rust is to have a In addition, the derive Rust attribute (e.g. Here's a coverage report demonstrating both of the above, and the Github workflow configuration file that contains the regex patterns. I probably wouldn't ignore assert_eq! (as that may be used in non-test code), but you could ignore it by passing Having two parameters is a bit redundant, but I assumed there is a good reason why lcov differentiates between ignored lines and branches.
lcov allows you to customize this with a machine-wide If you wanted to use this ignore pattern, you could pass
I'll rectify the remainder of your feedback tomorrow. Thanks! |
So, from some google research and your feedback, it looks like I should just use something like Sound correct?
Would the
I'm assuming that we can use the two to discriminate between lines to be completely ignored and lines which need to be counted for coverage but ignore that branches within the line aren't taken.
I don't have enough experience here to comment with any authority. Maybe others with some experience could chime in? I do like drop-in functionality that re-uses prior art and experience. If the thought is that the |
Sorry for the late response on this. It has been a crazy week for me.
That is correct.
Yes, it looks like lcov does this.
Happy to do this, if requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just fix the nits and it should be ok for merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx a lot
@jcdickinson could you update the README to explain how to use this new feature ? |
I have used |
Actually I reverted it to |
Adds line and branch exclusion, following the names of the vars in lcovrc. The lines are removed during path rewriting (as the full path is resolved during this phase). Resolves #261
Dangling regions at the end of files are permitted for e.g.
mod tests {
Also resolves some failing tests as well as compilation errors on Windows (see individual commits).