Closed Naresh-ibm closed 3 months ago
Any help will be really appreciated.
Is the question "why do I see these errors?" - or "how do I make the tool no longer report these errors?" or "how do I fix my code so that these errors no longer occur?" - or something different?
Looks like you are using gcc/11.4.1. Do you know if your kernel was compiled with the same version? I also think that you are using a moderately recent lcov download - not the 2.0 release. If you are not already using it, try again with the current lcov TOT (but I very much doubt that any of the errors will go away when you do that.)
I have seen all of the errors you see at one time or another - that's why lcov checks for them. If your coverage data is flakey - then your verification/validation process may not be doing what you think it is doing (and we care very deeply about that).
Some of the messages that I would be concerned about:
the mismatched end lines could be because you have objects (compilation units) which were compiled with two (or more than two) different versions of source files - i.e., the source files have different numbers of lines. If this is the case: then your coverage data will be somewhere between useless and misleading - the coverpoint on line 10 seen in one compilation unit is not the same as the coverpoint on line 10 from another compilation unit. Most often, I have seen this when libraries build from slightly different sources are linked together - though there are other creative ways that folks manage to create the issues.
the negative hit counts may be related to the -fprofile-update=atomic
bug (duckduckgo is your friend - some searching will lead you to some articles describing the issue and the workaround.
Or you can use the RC setting to tell the tool to silently treat them as zero.
the inconsistent branch- and line- hit count issue is another gcc bug - but I am a bit surprised that you are seeing it with gcc/11. My recollection is that it was in some earlier gcc versions and then disappeared in some newer versions. Again - you can tell the tool to ignore this.
Hope this helps.
Henry
Is the question "why do I see these errors?" - or "how do I make the tool no longer report these errors?" or "how do I fix >>>my code so that these errors no longer occur?" - or something different?
==>> yes, my question is, why tools produce these errors, and does it has any effect in manipulating the code coverage? more over the command I have ran exists with 1 even after using -rc and --ignore-errors. can we exit the command gracefully?
Looks like you are using gcc/11.4.1. Do you know if your kernel was compiled with the same version?
=====>> yes I have compiled with same kernel version
more over the command I have ran exists with 1 even after using -rc and --ignore-errors.
Your command line above does not appear to use either --ignore-errors ...
or --rc ...
- although perhaps you mean that you added some controls to your lcovrc file (however, the log above makes me believe that you did not edit your lcovrc file).
What does appear in your command line is --keep-going
- which tells the tool to continue after error (not stop).
However: it will still return a non-zero exit code if any errors happened. (We want that behaviour in our jenkins - for fairly obvious reasons, I think.)
See the man pages regarding the --ignore-errors
and --keep-going
options.
With respect to "... does it [have] any effect .. [on] code coverage?"
If you choose that route - and if your application is important/you require a high degree of confidence for your embedded system or critical application, then I would take a careful look at the coverage reports to verify that the data makes sense. For example, you do not expect to see:
Actually - I see that there is a discussion of some of the same issues you see, in #185. You might want to read that one over as well.
I don't think there is an lcov bug here - or, if there is a bug, I am not sure what it is.
In the spirit of cleaning up the issue list, could you either add a testcase which reproduces the problem if you think that there is an lcov bug here, or go ahead and close this issue if you think that this was not a bug (or is a gcc rather than lcov issue).
Closing this issue now. Existing cases work as expected.
If there is still a problem, please either reopen this issue or file a new one. Please include a testcase which illustrates the bug.
I am trying to get the code coverage using lcov and getting following errors and warnings,