Skip to content
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

Is there a problem with the results? #725

Open
heisen-li opened this issue Nov 27, 2021 · 9 comments
Open

Is there a problem with the results? #725

heisen-li opened this issue Nov 27, 2021 · 9 comments

Comments

@heisen-li
Copy link

heisen-li commented Nov 27, 2021

Q1:There are large sections of code that are not detected, either red or green.

example test file: ./rand/rand_chacha/src/guts.rs: L108-L127

image

Q2:Shows that there are four branches here, but there is no response test. But I don't see branches in the code.

example test file: ./rand/src/rngs/mock.rs

image

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cb412e3f2dc101799853216a75604f38

@corebreaker
Copy link

Yes, me too, block close are covered, it should not be. Maybe cause the droping.

@marco-c
Copy link
Collaborator

marco-c commented Dec 24, 2021

Are you using gcov-based coverage or source-based coverage?

For Q1, it's probably because of inline.

@corebreaker
Copy link

Even if it's caused by something, in any language, block close should not be in coverage result. Closing a block is an element of the structuration of the language.

We cover Rust code not the assembly generated.

@marco-c
Copy link
Collaborator

marco-c commented Dec 24, 2021

Oh actually it is unrelated to inlining, I think it's simply that those functions are only built on big endian and you are building for a little endian target.
Those functions, effectively, are just like comments for your target.

@marco-c
Copy link
Collaborator

marco-c commented Dec 24, 2021

Even if it's caused by something, in any language, block close should not be in coverage result. Closing a block is an element of the structuration of the language.

There are likely some instructions behind the block close. It's not really related to grcov though, this kind of thing is decided by the implementation of code coverage in the Rust compiler itself.

@corebreaker
Copy link

So what a pity that assembly code is covered, and finally i can't use grcov to cover only the Rust code without the assemby.

@heisen-li
Copy link
Author

I submitted more detailed information here.rust-lang/rust#91661

@heisen-li
Copy link
Author

heisen-li commented Dec 25, 2021

Are you using gcov-based coverage or source-based coverage?

For Q1, it's probably because of inline.

I know that the source-based approach does not support branch coverage. However, if branch coverage is not supported, 4 branches shouldn’t be shown here, right?

In addition, I think it is not the reason for inlining, it may be because of conditional compilation.
In the issue I mentioned, one of the same two functions was detected and the other was not.
rust-lang/rust#91661
image

@Mingun
Copy link

Mingun commented May 30, 2022

rust-lang/rust#91661 is closed, but coverage results still looks strange in some cases:

  1. sometimes comments shows as covered/non-covered (they should never fall to either of these categories)
  2. sometimes coverage report seems to shifted one line below
  3. sometimes the coverage highlight lines that does not contains executable code around it
  4. sometimes lines looks just random marked

For example, https://app.codecov.io/gh/tafia/quick-xml/blob/master/src/de/mod.rs:
quick-xml coveage 1
quick-xml coveage 2

I use source-based coverage, the full script here: https://github.com/tafia/quick-xml/blob/13d79c0f373172c86d89b009ebfec8055dacc7b1/.github/workflows/rust.yml

Don't known either, it is wrong data in the coverage report or just in the visualization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants