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

[question] Why only one braces is not covered in my project? #160

Closed
paulocoutinhox opened this issue Aug 10, 2022 · 13 comments
Closed

[question] Why only one braces is not covered in my project? #160

paulocoutinhox opened this issue Aug 10, 2022 · 13 comments

Comments

@paulocoutinhox
Copy link

Hi,

In my project appear in report that only one braces is not covered:

https://app.codecov.io/gh/nativium/nativium/blob/main/modules/app-core/implementation/cpp/nativium/core/ApplicationCoreImpl.cpp

image

Why this happen?

Thanks.

@henry2cox
Copy link
Collaborator

gcov artifact.
Very likely, some exception handling code (or something else) got inserted at the end of your function - but your code actually returns earlier than that so the coverage counter was not incremented. (You can check the asm code to see what the compiler actually created.)

My workaround is to filter the coverage data - in this case, to remove spurious zero counts from the function closing brace.
There is a longer discussion of the issue and the various other filters, in the 'differential coverage' pull request.

Hope that helps.

@paulocoutinhox
Copy link
Author

Hi,

Im searching for this "remove zero counts from the function closing braces", but im not finding how to solve this for all files.

I found:

How i can do it globally (from command line or something like this)?

Thanks.

@henry2cox
Copy link
Collaborator

henry2cox commented Aug 10, 2022 via email

@xaizek
Copy link

xaizek commented Aug 10, 2022

As I remember, codecov scripts upload coverage information to their servers for processing. So you want to consult their documentation for some kind of filtering and if that's not present suggest ignoring coverage information on lines like } to them. I doubt they are using lcov at all.

@paulocoutinhox
Copy link
Author

Sure, but locally the problem is the same with lcov report generator:

image

So, the real solution is fix lcov.

@xaizek
Copy link

xaizek commented Aug 10, 2022

Fixing lcov won't fix codecov.

@paulocoutinhox
Copy link
Author

But codecov use the lcov data. It shows exactly the same data from lcov.

@xaizek
Copy link

xaizek commented Aug 10, 2022

Both codecov and lcov use data from gcov. There is no need to use lcov for codecov, it will only make things harder.

@henry2cox
Copy link
Collaborator

henry2cox commented Aug 10, 2022 via email

@henry2cox
Copy link
Collaborator

henry2cox commented Aug 11, 2022 via email

@henry2cox
Copy link
Collaborator

The "--filter ..." features described above have been merged.
I'm fairly confident that it will remove the artifacts that you find confusing.

Could you test the current TOT to see if it meets your requirements or not.
If all is good: please close this request.
If something is missing: please clarify what is needed.
Thanks
Henry

@FreddyFunk
Copy link

@paulocoutinhox In case you still got this issue, try adding the compile options -fno-elide-constructors and -fno-default-inline in addition to -fprofile-arcs and -ftest-coverage as it may also help with coverage of "missing" constructors and inline functions. This fixed a similar issue for me when I was using GNU/GCC 11.3.

@henry2cox
Copy link
Collaborator

No comments/no followup for quite some long period.
I believe that the issue is addressed by the --filter brace option (to geninfo, lcov, or genhtml).
Please give it a try.

I'm closing this issue. If there is still a problem: please either reopen this one or file a new issue. Please provide detailed description of problem - ideally with a small testcase which exhibits the issue. Thanks
Henry

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