Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Simon_W_1
Beginner
42 Views

codecov with inline functions

Hi,

I have a C++ library with a set of unit tests that exercise the functions and classes in the library. I'm attempting to use codecov to give some feedback on the percentage of the library that is covered with the test cases. However, it looks as though codecov does not give results for inline functions unless they are instantiated and the compiler generates code for them.

Is this correct? If so, is there a good work around short of generating test cases for all of the inline functions, which soft of defeats the purpose of using codecov to view coverage results as test cases are added and the library evolves.

Thanks,

-Simon

0 Kudos
2 Replies
Kittur_G_Intel
Employee
42 Views

Hi Simon,
Tried a simple test case (as below) and one other as well. Compiling code as below  shows both main and myfoo executed even though the compiler inlines myfoo. So, inlining should not affect codecov results as it's computed independent of inlining.  IF you're using a template function and an inline member is never instantiated then it never becomes part of the application and so there isn't a reason for it to appear in the coverage report as well. So, a test case is warranted to find out what's going on.
---------------------
static int myfoo(int a, int b)

{
   return a + b;
}
extern int main(void)
{
   return myfoo(23, 56);
}
%icc –prof-gen=srcpos sm.c
%./a.out
%profmerge
%codecov –counts
-----------------------

Simon, can you please attach a small test reproducer to this post so we can investigate? Thanks

_Kittur

Kittur_G_Intel
Employee
42 Views

Hi Simon, 

Any update on attaching a reproducer? It'll be great if you can as I am not able to reproduce the issue :-(

_Kittur