I am setting up code coverage for an iOS application. I am using XCode 5.0.2 and gcovr 3.1 to test and perform code coverage for iOS 7 devices. I initially had issues with .gcda
file generation but I followed this blog and resolved the issue.
I have set ‘Generate test coverage files’ to ‘Yes’, ‘Instrument Program flow’ to ‘Yes’ for the Debug module only. I have also set -fprofile-arcs -ftest-coverage
for Debug module in ‘Other C Flags’. I have added __gcov_flush()
in my app code when application terminates.
Now .gcda files are generating without issues.
I then copy that to my workspace in my Home directory. From the workspace, I try to run code coverage for the application. I execute the gcovr
command from the command line, passing –object-directory
and gcov
command runs for the 252 gdca files I have. In the end I get this output:
Gathered coverage data for 0 files
Please help me in solving the issue. I have spent a lot of time browsing for similar issues but none of the solutions is working out.
I haven't tried copying the .gcda files elsewhere, but if I cd to the directory that the gcda files are generated in by default, then run gcovr with no arguments, I get valid results. Perhaps that's what you need to do?
I had this problem when I try to run gcovr but different (from compile) gcc version was enable. While you are running gcovr, try to check if your gcc version the same as gcc version while compiling your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With