> On Tue, Mar 8, 2011 at 8:58 PM, Anu <
anu...@gmail.com> wrote:
> > After unit test cases , I am now focused on code coverage analysis. I
Yes, and with good success. What I set up was inspired by Mike's
article that he mentioned above (thanks Mike!), but I've since made a
number of changes to fit our project. If you have any other problems,
please post back because I've probably already run into them.
On Mar 8, 3:17 pm, Mike Long <
mikelong2...@gmail.com> wrote:
> The way to get full coverage (for every part of the underlying binary) is to
> make sure that all the objects that are in your production code are in your
> test binary. You might need to reference a dummy symbol in each of your
> untested translation units to get the linker to pull them in.
We don't do this and everything works great, but we did use some other
workarounds that seem a bit easier to me:
1. Older versions of gcovr had problems finding source files not in
the same directories as the .gcda files (for instance if you're using
autotools). This has since been fixed, so just use the latest release
or at least make sure you have the patch from here:
https://software.sandia.gov/trac/fast/ticket/3872.
2. .gcda files are only produced for code that is run, so it's best if
you search for .gcno files as well, which will give you a better idea
of your overall coverage. See
https://software.sandia.gov/trac/fast/ticket/3887
for a patch to make gcovr do this for you.
Also, this isn't really related, but another problem I had is fixed
with a patch here:
https://software.sandia.gov/trac/fast/ticket/3888.
Lastly, make sure your running gcovr with the right command. Here's
what we use:
gcovr -e '/usr' -e '.+/test/.+' -e 'gtest' -r . -x
Hope that helps. Thanks again Mike.
- Daniel