Replies: 4 comments 2 replies
-
Short answer: yes, this works as you would expect it to. Longer answer: only if the C++ code in question is instantiated. In particular: template functions or template methods which are not instantiated, do not have code generated for them - so they are simply not in the coverage data. |
Beta Was this translation helpful? Give feedback.
-
Forgot to mention:
Source for that method is unchanged from your baseline, but now that source "is code" (because it appears in the coverage data).
This is the reason that the default differential coverage criteria script uses "LBC + UNC + UIC == 0" (see |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply Henry. The methods are not explicitly tagged as 'inline', nor are they templated. Here is a very streamlined clip of the code in question:
I am finding that the lcov invocation is simply not producing information for this header file, or rather, that the information section in the .info files are basically empty. Here is the relevant section from the baseline .info file (directory structure elided with [...]) in the SF line below):
and here it is from the current .info file:
The invocation of lcov follows the lcov example, though I added the '-all' in an effort to get my header code to show up, is basically the following (I have the latest lcov code in $HOME/dev/lcov):
|
Beta Was this translation helpful? Give feedback.
-
class (struct) methods whose definition are in the body of the class are inline (see language spec) - so the coverage artifacts are behaving more-or-less as one might expect (especially if your actual |
Beta Was this translation helpful? Give feedback.
-
Before I dive in, thanks for all the work on this project, we are finding the tools here very useful.
I have struggled for nearly half a day with this, and I may be making a glaring mistake, so I am raising the issue here rather than creating a bug report. First, before I lay out in detail what I'm doing, I will give a very brief overview in form of what I am doing, and will pose a general question. If the answer to my question is a resounding "yes, you should be able to do that", then I'll post more detail.
I am finding that no matter what I do, if I have baseline code committed and am able to build, run tests, etc., then some time later if I add a method to a class in my header file but I do not add a test for this new function in my test code, not only does the uncovered method in the header not get reported (after build, test, report generation), the header file itself does not show up in the report. If I then add a new fake test method to the class in the header and invoke that from within my test, the header file does show up in the coverage, and the new fake test method shows as being covered, but the previous uncovered method shows no indication that it is uncovered.
The general question is, then, using the latest lcov code is it possible to generate a differential coverage report that shows UNC (uncovered new code) for code that is in a C++ header file?
Beta Was this translation helpful? Give feedback.
All reactions