-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFT (request for tips): tweaking .cov files, aka code_coverage output #7541
Comments
Another big part of the overestimation comes from the often-used |
True. Though when it's |
Similarly for ternary operator ...you may want to check that the BoundsError is correctly triggered. |
It seems to me that the most interesting coverage question is of all the branch points in your program, how many of the possible branches do you take? I'm not sure if this is equivalent to fraction of basic blocks covered. At that point, you can consider 2-grams of basic blocks, 3-grams of basic blocks, etc. |
The branches question is indeed relevant, but we shouldn't let ourselves get distracted by it: browsing through the You can see this result again and again throughout the complete results. |
How will we stop functions that are tested but always inlined from counting against the coverage percentage? |
Disable inlining when performing |
Disabling inlining is really not realistic. |
If one cares, then I suppose the alternative would be to have an analysis tool that flags all functions that will be inlined. But if this is the only application, that seems a little excessive---this is just supposed to be a guide for helping people write more comprehensive tests, and that is something that already requires a little intelligence. I care less about what the actual coverage number is. |
If we do want to add branch coverage, Ned Batchelder's much-used As for the inlining issue: It seems to me that that could be important. If one wants 100% coverage (which could be useful, if one wants to add a test for it, for example—or we want a command-line switch for ensuring 100% coverage, like dlang), the plethora of tiny functions that seem idiomatic to Julia would seriously mess with that, no? If disabling inlining is unrealistic—is it possible to record where a function is inlined, and work with that? Or … if functions are going to be inlined, if we know that when we compile them (as in @timholy's suggestion, here), could we not just use that as a reason to not flag them as compiled? In a sense, they haven't been compiled as individual functions (from the perspective of coverage) anyway. Then we will "sort of" get 100% coverage if and only if we have executed all the code, including the inlined functions. (Not talking about branch coverage here.) The only issue is that we won't be able to count individual lines in the inlined functions, but that's perhaps less crucial, if they're going to be tiny anyway, in general? |
Currently the Besides inlining, the other big ticket item is precompilation, which currently has the same effect. You can work around this by deleting |
For the inlining problem, perhaps we could have |
In combination with other work in base ( |
In these issues:
JuliaCI/Coverage.jl#4
JuliaCI/Coverage.jl#11
it was noticed that it's difficult to accurately calculate coverage, given the format of the .cov files. @IainNZ suggested that this is best fixed in julia, since its parsing is definitive.
I have a general idea of how to fix this, but I could use some help with the details:
for each method in the file. The initial setting for
iscompiled
is false. Methods are stored in the order of appearance in the file.2. Have
coverageVisitLine
, which gets called when functions are compiled, setiscompiled
to true3. In
jl_write_coverage_data
, when you get to the first line of the next method in the list, checkiscompiled
. If false, prepend0
instead of-
for each line of the function. This will even penalize comments,end
statements, etc, but I think it's better to err in this direction---it's extra incentive to make sure all functions are tested.The part I'm stuck on is finding the best place for step 1. My favorite candidate is here, but I'm not at all sure about this.
The text was updated successfully, but these errors were encountered: