On Mar 22, 2009, at 8:53 AM, Rob Evans wrote:
So, my best guess is that that code injection is not happening at
runtime. Here's why:
* Console output of tests is not visible, which indicates that tests
are not being executed at runtime
* Unit test breakpoints are "orange" indicating that GDB can not
locate the instructions/code
But interestingly, running lsof against the running application, I can
see that DevToolsBundleInjection is being opened
What can I do to gain some insight into what is actually happening
with DevToolsBundleInjection? For example, since breakpoints set in my
application code *do* work, is there a means of using GDB that would
allow me to determine with certainty whether or not my test code has
been properly injected? Anything else I should try?
What environment variables and arguments have you set on your executable? That's critical to determining why tests aren't being injected. You need to specify, at minimum, these environment variables:
- DYLD_FALLBACK_FRAMEWORK_PATH with a value of $(DEVELOPER_LIBRARY_DIR)/Frameworks
- DYLD_INSERT_LIBRARIES with a value of $(DEVELOPER_LIBRARY_DIR)/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection
- XCInjectBundle with a value of $(BUILT_PRODUCTS_DIR)/MyTestBundle.octest
- XCInjectBundleInto with a value of $(BUILT_PRODUCTS_DIR)/MyApplication.app/Contents/MacOS/MyApplication
And you need to specify this pair of arguments:
- -SenTest All to indicate that all tests should be run; instead of All you can use the name of a test case class to run all tests in that class, or TestCaseClassName/testMethodName to run a single test method.
With all of those specified, running/debugging your application executable from Xcode should also result in your tests being executed, and their output showing up in the debug console.
BTW, DevToolsBundleInjection injects code at runtime only, yes? So
running class-dump against the executable won't help...
DevToolsBundleInjection is used both at run time and when running unit tests during a build; it is how tests get into the address space & process of your application to run in the first place. class-dump won't really help regardless, due to the way DevToolsBundleInjection is implemented.