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
Link Copied
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
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
For more complete information about compiler optimizations, see our Optimization Notice.