• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unit Tests, Breakpoint, and the color Orange
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unit Tests, Breakpoint, and the color Orange


  • Subject: Re: Unit Tests, Breakpoint, and the color Orange
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 22 Mar 2009 19:38:51 -0700

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.

There's more information here:  http://chanson.livejournal.com/120740.html

  -- Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Unit Tests, Breakpoint, and the color Orange (From: Rob Evans <email@hidden>)

  • Prev by Date: Re: What VCS do you use with xCode?
  • Next by Date: Re: What VCS do you use with xCode?
  • Previous by thread: Unit Tests, Breakpoint, and the color Orange
  • Next by thread: Re: Unit Tests, Breakpoint, and the color Orange
  • Index(es):
    • Date
    • Thread