-
Notifications
You must be signed in to change notification settings - Fork 68
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
Improve coverage heuristic in function_body_lines #210
Improve coverage heuristic in function_body_lines #210
Conversation
Codecov Report
@@ Coverage Diff @@
## master #210 +/- ##
==========================================
+ Coverage 80.18% 82.31% +2.13%
==========================================
Files 6 6
Lines 333 328 -5
==========================================
+ Hits 267 270 +3
+ Misses 66 58 -8
Continue to review full report at Codecov.
|
Nice, this seems to work, and thus improves coverage even for Coverage.jl; but it's not yet "perfect", e.g. https://codecov.io/gh/JuliaCI/Coverage.jl/src/f06e6fe198fa14e71e92eabcba51da77f5c25644/src/lcov.jl#L72 still gets marked as code; I am not quite sure why. So even with this, there is probably still some need for PR #208, but hopefully less so. |
f06e6fe
to
8a105a7
Compare
The purpose of function_body_lines is to find functions which are "dead" (= never executed by test suite), and mark them as code, because Julia's built-in coverage code does not do that; if we were to rely on it, such functions would be marked as non-code, and thus they do not show up in the overall code coverage percentage. But our current heuristic is too aggressive in so far as that Julia also sometimes marks code lines as "is not code" in the middle of functions that are being executed (most likely due to inlining and other optimizations). If we mark those lines as code, they will show up as uncovered, with no way for the package author to change this. With this commit, we refine our heuristic: we only apply it to functions for which Julia recorded no coverage at all, as before; but if even just one line in the function body has coverage information, we do not touch the code lines in it at all. Some care must be taken to make sure this works right for nested functions.
8a105a7
to
eae1476
Compare
I don't understand this part of the code well enough to provide a particularly meaningful review, but for what it's worth, nothing looks blaringly wrong to me. 😛 Perhaps @vtjnash would be able to provide more insight? |
Of course if something is wrong (blaringly or not), I'll work on fixing it (or at worst, we can revert the change again). |
Is there any hope that at some point julia will just output the correct info here, so that Coverage.jl doesn't have to patch things up? Is there a julia issue tracking this? |
@davidanthoff as discussed on issue #187, the relevant Julia issue is |
Improve coverage heuristic in function_body_lines
The purpose of function_body_lines is to find functions which are "dead" (= never executed by test suite), and mark them as code, because Julia's built-in coverage code does not do that; if we were to rely on it, such functions would be marked as non-code, and thus they do not show up in the overall code coverage percentage.
But our current heuristic is too aggressive in so far as that Julia also sometimes marks code lines as "is not code" in the middle of functions that are being executed (most likely due to inlining and other optimizations). If we mark those lines as code, they will show up as uncovered, with no way for the package author to change this.
With this commit, we refine our heuristic: we only apply it to functions for which Julia recorded no coverage at all, as before; but if even just one line in the function body has coverage information, we do not touch the code lines in it at all.
Some care must be taken to make sure this works right for nested functions.
Closes #188