(Xcode 4.5)
When running instruments from the command line it works the first time but then it won't run again until after I reboot.
The verbose output from Instruments includes this:
Instruments : Loading template 'file://localhost/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate'
Instruments : Setting Instrument Trace Command : Instrument Command (purpose:Idle; output destination:file://localhost/Users/xxxxx/instrumentscli0.trace)
Instruments : Trace Command Recognized
Instruments : Instrument 'Automation - MyProject' rejected command 'Instrument Command (purpose:Trace; output destination:file://localhost/Users/xxxxx/instrumentscli0.trace)' for target 'Executable (name:MyProject; arguments:)'
Instruments : Instruments Rejected Command
Instruments Trace Error : Failed to start trace.
The command line I'm using to run instruments is this (split onto multiple lines for clarity):
instruments -v -w <DeviceID>
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
/Users/xxxxx/dev/MyProject/build/Debug-iphoneos/MyProject.app
-e UIASCRIPT /Users/xxxxx/dev/MyProject/UIAutoTests/some_test.js
I've tried comparing what processes were running before and after the first (successful) run using ps
and what files/pipes were open before and after using lsof
, but I can't find anything to suggest why it won't run more than once.
The error seems to suggest that the automation instrument within instruments is rejecting the purpose:Trace
command, so I've tried deleting the output trace directory (in case the auto-incremented filename was causing a problem), I've tried running instruments with a different template between runs to see if this clears whatever is blocking it, but I can't get it to work more than once per reboot.
My suspicion is that there is some invalid state in the Automation instrument or in a shared library used by instruments. I need a way to reset this state from the command line so that I can run the automated tests reliably on a CI server.
Is there a way to compare what shared libraries are loaded before/after and unload them? Does anyone have any other ideas of what might be persisting and how to reset it?
Try downloading Xcode 4.4.1 (iOS dev center) and use its instruments 4.4 (4445). This version is working for all my devices.
FYI, when I use 4.5+, or even 4.6DP4, only iOS6 devices respond normally; others would fail with the same message as yours. Give it a try, maybe even 4.3.3 if 4.4 doesn't work well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With