Code coverage files are not created on OSX Lion

I'm trying to get code coverage for my unit tests (Xcode 4.2.1 (4D502) on Mac OS X Lion 10.7 (11A2061)), but somehow .gcda files are not created. I can see the .d and .o files in the ... / Objects -normal / i386 folder of the unit test target, but the gcno / gcda files are not available for the modules under test, and therefore I can not generate coverage statistics for the tested ones.

For the main purpose, I see .d, .o and .gcno files for each file.

So, I believe that the project settings are configured correctly, but there is a “small” something really missing for OS X Lion. I tried the steps mentioned at http://code.google.com/p/coverstory/wiki/UsingCoverstory but didn't seem to solve my problem.

Note. I was able to get this to work on Snow Leopard and view coverage statistics using CoverStory !!

Any decision / direction in this regard would be very helpful. Thank!!

+3
source share
2 answers

I was missing gcda files, but found a solution on some website. You need to add these flags:

-fprofile-arcs -ftest-coverage

in "Other Flags C". After running the tests, gcda files are present.

Gcno files are generated after installing "YES" for "Generate Coverage Files" and "Tool Flow".

I am using the Xcode 4.3.2 compiler and llvm.

As an alternative, I found that setting the Generate Profiling Code to YES also causes the creation of gcda files.

+4
source

, :

GCC_PREPROCESSOR_DEFINITIONS = GCOV_ENABLED=1

GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES

GCC_GENERATE_TEST_COVERAGE_FILES = YES

/ gcda. , xcconfig, . gcov Xcode.

0

All Articles