Scott Chamberlin
Scott Chamberlin

Reputation: 724

How to make xcode4 code-coverage with llvm cumulative across application executions

I have code coverage in XCode 4.2 with libprofile_rt working. I have noticed that the coverage files are reset for every execution of my program. This is different from the way gcov worked and its something I need to work (since my tests execute across multiple runs of my app). Can someone point me to the way to make libprofile_rt generate cumulative coverage?

Upvotes: 4

Views: 461

Answers (2)

Vijay
Vijay

Reputation: 889

You don't need to include *libprofile_rt.dylib* and use *-profile_rt* flag when running project in xCode 4.4.1 (works with iOS Simulator like a charm) Just set these flags:

Generate Test Coverage Files: YES Instrument Program Flow: YES Build and run. In case you runt Test-target of your app, *.gcda files are created automatically because tested app terminates, in case of running regular target, *.gcda files are created when you explicitly kill your app (the other approach is to set UIApplicationExitsOnSuspend = YES in .plist)

Please note, it was well tested on new project created with xCode 4.4.1

Code coverage files will be output to /Build/Intermediates/.build//.build/Objects-normal/

Upvotes: 1

Scott Chamberlin
Scott Chamberlin

Reputation: 724

actually looks to be an existing bug in LLVM: http://llvm.org/bugs/show_bug.cgi?id=11457

Upvotes: 2

Related Questions