2

I am able to run instrument using command line for a single device / simulator, but I need to run it on two devices. Manually I can achieve this by opening two new window of Instruments and make two copy of the js and import it. But I need to achieve this using Command Line. Can anybody help me in achieving this or does anybody have the guidelines for the same?

Sanjay
  • 97
  • 4

2 Answers2

7

I struggled with this as well here is a part of my solution. What i did is:

Create trace files in instruments with you script .js file pre selected and save it to disk.

Reads the UDID of all connected devices. Loop trough all connected devices and replace the UDID in your trace file with the currenct UDID. In the same loop open instruments.

for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
  UDID=${line}
  file$x $(replace 345w67ww89ww0w98w762wewq33e2 with ${UDID})
  open -a Instruments /PATH/TO/TRACE/file$x
done

This solution will open multiple windows of Instruments. You can go trough them with appleScript to click the record button.

user728881
  • 71
  • 3
  • Another way to achieve it is to open two separate instance of Instrument and execute it – Sanjay Dec 24 '13 at 09:16
  • Hi user728881, Could you please elaborate on the 3rd line - the code to replace the string? I couldn't get it to work, and a simple 'sed' command doesn't work on the .trace file either. Appreciate any help!! – Manju Jul 03 '14 at 07:09
0

Another way to achieve it is to open two separate instance of Instrument and execute it

Sanjay
  • 97
  • 4
  • How will you do that Sanjay? If i open one instance on Terminal 1, and try to open another instance in terminal 2, it disconnect the previous instance opened in terminal 1 – iamMobile Jun 13 '14 at 22:45