views:

40

answers:

1

I have overcome all problems with setting up gcov on my iPhone project but now I am getting the following:

profiling:/Users:Cannot create directory

Does anyone have any suggestions as to what I might be doing wrong?

I originally setup gcov following Google's instructions which can be found by Googling "UsingCoverStory"

UPDATE: Okay, so let me clarify what I am trying to do. I have an iPhone app that I trying to test automatically. I am using the UISpec framework to drive the GUI. What I really what to know is how much code I am actually covering with my tests. I think that I am really close but I just need to understand how to properly set the environment/compiler variables to fit my project.

Here is a summary of what I have done so far. I first copied my build target, specified the linker flag and a couple of other options as prescribed. (This can be done automatically using an AppleScript created by Google. Instructions and download can be found by Googling "UsingCoverStory") Anyway, I have verified that these settings are being assigned correctly. I set my config to Debug and I am running this on a 3.1.3 Device. When I run the app, it doesn't show anything special in the debugger until I exit the app. At that point I get an error:

profiling:/Users:Cannot create directory profiling:/Users/forbushbl/Documents/TestApp/build/TestApp.build/Debug-iphoneos/TestApp copy.build/Objects-normal/armv6/ApplicationController.gcda:Skip

I assume that GCOV is trying to write out the .gcda files but I'm not quite sure how to tell it where they should be written. I read somewhere that that GCOV tries to reproduce the directory structure where the .gcno files are stored in my project folder which would make sense as the directory above is where the .gcno files are located on my machine. However this is a problem because that structure doesn't exist on the iPhone nor can the device create that structure. I found another person with the same problem and they said that they had to set an environment variable. http://stackoverflow.com/questions/1945229/how-to-set-up-gcov-for-code-coverage-analysis-in-iphone-sdk

The GCOV documentation says the following: For example, if the object file /user/build/foo.o was built with -fprofile-arcs, the final executable will try to create the data file /user/build/foo.gcda when running on the target system. This will fail if the corresponding directory does not exist and it is unable to create it. This can be overcome by, for example, setting the environment as GCOV_PREFIX=/target/run' andGCOV_PREFIX_STRIP=1'. Such a setting will name the data file /target/run/build/foo.gcda.

My question is, how do I set these environment variable on the iPhone? Should I be doing this in my build configuration or within the actual code?

A: 

You should be able to set these env vars in your executable settings. Open up the "executables" branch of your project (in the tree/disclosure view) and then double click on your executable. Under the arguments pane you can set environment variables.

dmaclach