I'm developing a database-access library and I'm trying to check for memory leaks using already-written unit tests.
These are logic tests based on SenTestingKit, set up the normal way in Xcode 4.2. I can run them fine using Cmd-U but don't see a way to start them from Instruments, or to invoke Instruments to examine them.
How can I make this work? Do I need to write new cases and build them into an application?
(This question is about leak-checking unit tests but I think is pre-SenTestingKit.)
This answer begins with SenTest for OS X. If you are concerned with using SenTest for iOS under instruments, skip to the next section.
I realize this is a bit late, but I needed to run instruments on a logic test today and got it working for my environment, so here's what I did:
OBCJ_DISABLE_GC
with a value of YES
as an environment variable (don't do this if you're running GC)DYLD_FRAMEWORK_PATH
and point at the directory containing of your .octest packageDYLD_LIBRARY_PATH
with the same value as DYLD_FRAMEWORK_PATH-SenTest Self
and the full path to your .octest packageSome of the environment variables and your working directory may not be essential depending on whether you need additional frameworks to load and whether you have test files in your code directory that require reading. So, you may omit those steps if they don't apply to you.
Once you're done, you'll be able to Save the document and use it to run the tests.
After the OP clarified the requirements, I went about verifying the basic instructions for this with an iOS-simulator-based project.
For iOS, you need a somewhat different configuration, owing to the fact that you're debugging a different executable, and you will need different libraries. So, the DYLD_FRAMEWORK_PATH will include both the path to your .octest package's directory, and that of the Simulator's Frameworks. The latter will be something like this:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/Developer/Library/Frameworks
depending on which version of the simulator you are using and we'll refer to it below as SDKPATH
/Applications/Xcode
and find the otest binary inside of /Applications/Xcode/Developer/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/Developer/usr/bin/
and select itDYLD_LIBRARY_PATH
and point at the directory containing of your .octest packageDYLD_ROOT_PATH
pointed just at the SDKPATH (above)IPHONE_SIMULATOR_ROOT
with SDKPATH (above)DYLD_FRAMEWORK_PATH
and point at the directory containing of your .octest package and the SDKPATH (above), separating them by a colon (:
) in the path listCFFIXED_USER_HOME
with your iPhone simulator home (~/Library/Application Support/iPhone Simulator
although I've expanded it before putting it here, as I'm not sure the ~ gets interpreted)-SenTest Self
and the full path to your .octest package