I would like to know how I can generate gcda files when an iOS application is running unit tests on an Xcode bot.
I used this blog to configure Xcode to generate test coverage files and generate a report using a script that utilizes lcov. I can consistently create the coverage files and the report on my development computer but when the bot attempts the same process, no .gcda files appear. When calling __gcov_flush()
on the bot, I can see the following error in the log:
profiling:/Library/Server/Xcode/Data/BotRuns/Cache/c0jhd288-c473-c473-2432-f8219hdh98dh89/DerivedData/Build/Intermediates/AppName.build/Debug-iphonesimulator/appName.build/Objects-normal/i386/ClassName.gcda: cannot open
I know this is occurring during the application's gcov flush because I placed a log directly before and after the call"
NSLog(@"[application performSelector:@selector(gtm_gcov_flush)]; will be CALLED");
[application performSelector:@selector(gtm_gcov_flush)];
NSLog(@"[application performSelector:@selector(gtm_gcov_flush)]; was CALLED");
NOTE: gtm_gcov_flush
only calls __gcov_flush()
and nothing else.
Searching for "profile gcda: cannot open" lead me here, but I am already following the suggested requirements by following the above blog link. It is possible there are some permission issues but that seems unlikely since Xcode is the one generating the gcda files.
I have checked the /Library/Server/Xcode/Data/BotRuns/
, /Users/username/Library/Developer/Xcode/DerivedData/
, and /var/_xcstest
directories and their subdirectories for gcda files and there are none in sight. However, there are gcno, o, d, and dia files in /Library/Server/Xcode/Data/BotRuns/Cache/c0jhd288-c473-c473-2432-f8219hdh98dh89/DerivedData/Build/Intermediates/AppName.build/Debug-iphonesimulator/appName.build/Objects-normal/i386/
(where there should be gcda files).
Like I said, I have had zero issues with the while running locally. The script XcodeCoverage/getcov is being called in the post-action phase of Archive in my scheme. I am using Xcode 5.0.2 on my development mac as well as via Xcode service on the CI server. Unit tests are being ran with the XCTest framework.
Thanks for your help in advance!