Open ptomulik opened 10 years ago
I just ran into this also. Using --gcov-options '\-lp'
fixed it for me too. It seems like gcovr avoids this by parsing the gcov files immediately after running gcov.
Unfortunately, adding --gcov-options '-lp' does not work for me. I tried this proposal in my project tysonite/asn1-complier, but I still got incomplete coverage information for header files (.hh).
Comparing the results of code coverage of local "lcov" and "cpp-coveralls" / coveralls.io show different results.
Did you noted the backslash '\' before '-lp'? I remember, it was important (but can't recall how it affected the output at the moment).
Yes, it is a misprint in my previous comment. I did similar what you wrote in a top post, look here: https://github.com/tysonite/asn1-compiler/blob/master/.travis.yml
@tysonite Looking at your travis file, it looks like you're excluding all CMakeFiles
directories and the tests
directories. However, that's where all of the coverage files get output to, and the --exclude
option will prevent cpp-coveralls from including any coverage files found in those directories. I think if you remove those excludes it should pick up everything. Like, here's where the coverage files end up for your project.
Maybe the --exclude
option should be changed to only work on the source file path and not the path of the .gcno
file?
@briangreenery, thank you for your help and time. I removed all "--exclude" options from cpp-coveralls command line and now see the full coverage report.
I will need to refine .travis.yml somehow in order to remove unneeded files from the overall report. However, it is not clear for me when I look at the README.md that ".gcno" files will be excluded, I thought that final coverage report will not include statistics for the excluded file/directory.
WIth defaul options the hit counts for inline functions (or class methods defined in headers) are usually inacurrate. This usually happens when a function is referred by more than one module, all being in same directory. The reason is that gcov overrides its *.gcov files. A remedy for this is to use
-l
gcov option, i.e:IMHO, a good common practice would be to use also
-p
gcov option (preserve paths).I think this is worth to be mentioned in documentation (README). This may save many troubles to people using cpp-coveralls.