views:

134

answers:

1

The Problem

I've got a Cocoa project on the desktop and I'm using Xcode 3.2.1 on Snow Leopard 10.6.2.

I want to generate code coverage files for my Unit Test Target in Xcode.

What I've Tried

As articles like this one suggest, I've adjusted the build settings to:

“Generate Test Coverage Files” checked “Instrument Program Flow” checked “-lgcov” added to “Other Linker Flags”

I've also set the Run Script section of the test target to have the following:

# Run the unit tests in this test bundle.
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"

# Run gcov on the framework getting tested
if [ "${CONFIGURATION}" = 'Coverage' ]; then
     FRAMEWORK_NAME=LapsusInterpretationEngine
     FRAMEWORK_OBJ_DIR=${OBJROOT}/${FRAMEWORK_NAME}.build/${CONFIGURATION}/EngineTests.build/Objects-normal/${NATIVE_ARCH}
     mkdir -p coverage
     pushd coverage
     find ${OBJROOT} -name *.gcda -exec gcov -o ${FRAMEWORK_OBJ_DIR} {} \;
     popd 
fi 

Since my Framework name is LapsusInterpretationEngine but my target is named EngineTests, I put this directly into the FRAMEWORK_OBJ_DIR but this didn't seem to help.

I've tried cleaning before building. I've made sure all the above build settings apply to both the Unit Test Target and the Application Target.

What I Get

No .gcda or .gcno files anywhere in the build directory I'm using.

I point CoverStory to the Objects-normal directory in my builds folder and it complains that there's nothing there for it to read.

I must be doing something really obvious wrong. Anyone any ideas?

I have tried the "EngineTests.build" directory being ${FRAMEWORK_NAME} and this gives the same results.

A: 

This is a duplicate as Peter Hosey suggests of this question.

John Gallagher