Yep - don't link to libprofile_rt.dylib, because if you set the following settings:
-- Instrument Program Flow : YES
--Generate Test Coverage Files : YES
. . . then it will link to the lib profile for you.
Also (important), there's a bug in a function mapping that can be corrected by adding a class to you project like so:
#import <Foundation/Foundation.h>
/**
* This fixes a problem related to an Apple implementation of a core unix api.
*/
@interface CoverageFix : NSObject
FILE* fopen$UNIX2003(const char* filename, const char* mode);
size_t fwrite$UNIX2003(const void* ptr, size_t size, size_t nitems, FILE* stream);
@end
#import "CoverageFix.h"
@implementation CoverageFix
FILE* fopen$UNIX2003(const char* filename, const char* mode) {
return fopen(filename, mode);
}
size_t fwrite$UNIX2003(const void* ptr, size_t size, size_t nitems, FILE* stream) {
return fwrite(ptr, size, nitems, stream);
}
@end
Having done that you'll have .gcda files in your build products directory. You can turn them into a report with Cover Story, but I like to use lcov to produce HTML reports. The advantage of this is:
1. A cmd-line build that can be run either on the devs machine or on the CI server, with same setup.
2. Ability to add coverage assertions - so that the build fails with insufficient coverage.
Let me know if you need any help.
Jasper