You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If multiple derive macros are used, and one is covered and one is uncovered, the results shown in the llvm-cov output will not match the output produced by json.get_uncovered_lines(). While llvm-cov considers the line to be uncovered, json.get_uncovered_lines() considers the line to be covered. So even if there is a missing line, --show-missing-lines will not show the affected line and --fail-uncovered-lines 0 will have no effect.
The function created by the strum::EnumIter macro is tested, while the function created by the strum::Display macro is not. llvm-cov considers line 3 to be uncovered, but this line is considered to be covered by json.get_uncovered_lines(). This issue is caused by the following code, which was added to fix #181:
Unfortunately, I don't see a simple solution which wouldn't add a regression. Any ideas?
Using the JSON output for --fail-uncovered-lines would already be an improvement, so that at least the exit code would be correct, even if some lines in --show-missing-lines are missing. What do you think?
The text was updated successfully, but these errors were encountered:
(It doesn't resolve the underlying issue, but I guess the case itself could be resolved by using #[automatically_derived] in strum, considering rust-lang/rust#120185.)
I think the root of the trouble is that llvm's JSON output tells us the line coverage percentage, so if it's complete or not is precise, but what lines are covered is not in the JSON explicitly. llvm's code is quite complex, tries to deal with c++ templates and macros..
My code here is obviously quite naive, but then with some iterations it turned out to be quite usable in practice.
So if your problem is about the percentage reported, that's from llvm. If the percentage is <100, but you're not happy with the reported reported lines, then the JSON parsing code (in rust) can be tweaked.
I guess the only important point is to make sure the percentage keeps coming from llvm, not our own calculation. Does this help?
If multiple derive macros are used, and one is covered and one is uncovered, the results shown in the
llvm-cov
output will not match the output produced byjson.get_uncovered_lines()
. Whilellvm-cov
considers the line to be uncovered,json.get_uncovered_lines()
considers the line to be covered. So even if there is a missing line,--show-missing-lines
will not show the affected line and--fail-uncovered-lines 0
will have no effect.Here is a reproducer:
The function created by the
strum::EnumIter
macro is tested, while the function created by thestrum::Display
macro is not.llvm-cov
considers line 3 to be uncovered, but this line is considered to be covered byjson.get_uncovered_lines()
. This issue is caused by the following code, which was added to fix #181:cargo-llvm-cov/src/json.rs
Lines 268 to 270 in b7e5eb5
Unfortunately, I don't see a simple solution which wouldn't add a regression. Any ideas?
Using the JSON output for
--fail-uncovered-lines
would already be an improvement, so that at least the exit code would be correct, even if some lines in--show-missing-lines
are missing. What do you think?The text was updated successfully, but these errors were encountered: