-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Some misses in coverage #136
Comments
So most of these I'm already aware of via #63 the With the DWARF tables multiple instructions map to the same line and some of them if instrumented will be hit some won't. I know that can fix the chained operators on iterators from some experiments I've done. However, I haven't yet found any sources on what instructions to prefer or a way of determining the best instruction analytically... I'm going to keep trying to figure it out but any help anyone can offer is appreciated |
So hope you don't mind I've added a checklist to the top comment just so I can see progress from the main issues page 👍 |
So without any work of my own I've just tested the multiline As the compiler changes I sometimes find coverage issues appear and disappear based on the outputted assembly so unless anyone can show any examples of them still existing I'll keep them checked off.
|
Are there still plans to build a regression test suite? And what are the best ways for the community to help you improve coverage? |
Well right now I'm running tarpaulin on faktory-rs so I can go over the reports and look for any coverage issues. At some point I would like the integration tests to be a lot better, completely overhaul the projects. It would need an amount of work into figuring out what coverage should look like. Obviously some of the like the proc-macro test and simple-project currently serve a purpose. I think a good starting point for tests would be a project for each expression in https://docs.rs/syn/0.15.11/syn/enum.Expr.html that demonstrates every form each expression could take and what is expected from coverage. I'll try and do some tests like this some point this week to work as a template and we'll see where it goes from there. If I do I'll post any follow up on #54 so as not to distract too much from this issue (although they are obviously interlinked) |
I have some more data to add to this from my own recent test. This is using the published version of tarpaulin, so some of these may have been fixed already. I've marked the lines that tarpaulin said were covered: impl Parse for CustomAssert {
> fn parse(input: ParseStream) -> parse::Result<Self> {
let expr = input.call(Expr::parse)?; // Required expression
if input.parse::<Token![,]>().is_ok() { // Optional message
> let message = input.call(Punctuated::parse_separated_nonempty)?;
> Ok(CustomAssert { expr, message })
> } else {
> Ok(CustomAssert { expr, message: Punctuated::new() })
}
}
} The code actually took the But the hits after this snippet in the same file were where I expected, so I don't know if the hits were actually being reported 2 lines ahead of where they should be. The other option is that the first two lines weren't registered and the tracer mistakenly grouped the Edit: Those were the results when I called let message = input.call(Punctuated::parse_separated_nonempty)?;
Ok(CustomAssert { expr, message })
} else { I'm not sure why they would be different. |
One thing I'd like to add is that the |
@xd009642 here's another coverage test for |
panic lines are missed too. |
I think #185 is related to this. |
Another one: on inlined functions, the first line (i.e. the one with the To reproduce: #[inline(always)]
fn foo() {
println!()
}
#[test]
fn test_foo() {
foo();
} Line 2 ( Ref #79 |
It looks like |
...aaaand another one: miss:
works fine:
swapping the two match arms also works fine:
|
Same issue with log statements in matches ;) |
Multiline |
There are some improvements to coverage in develop that catch some false negatives. Won't fix all the issues but it will help with a number of them. I also might close this issue and the other missing coverage ones and make a pinned one |
Closing in favour of #351 |
On my last coverage I've spotted a few oddities in the coverage:
an
else
alone on its line is the only uncovered line of the functionsee https://codecov.io/gh/Smithay/wayland-rs/src/master/wayland-commons/src/socket.rs#L33
The content of both branches of an
if
is marked as covered, but the line containing only} else {
is marked as uncovered.a
let v =
expression split onto two linessee https://codecov.io/gh/Smithay/wayland-rs/src/master/wayland-commons/src/socket.rs#L198
the code is basically
The line containing
let var =
is marked as uncovered, while the second one is marked as covered.chained operations on iterators are not consistently
see https://codecov.io/gh/Smithay/wayland-rs/src/master/wayland-commons/src/wire.rs#L243
I have something like
the
let ...
lines and.map(
are marked covered, while theiter()
andcollect()
ones are marked as not covered.a match arm marked uncovered while its contents are covered
see https://codecov.io/gh/Smithay/wayland-rs/src/master/wayland-commons/src/wire.rs#L259
It is something like
the line with
another_thing()
is marked covered, by the line withMatch2 => {
is marked as not covered.EDIT: Checklist!
assert_eq!
collect::<_>()?
and other issues with?
on function callslet x = unsafe {\n
else
PhantomData
The text was updated successfully, but these errors were encountered: