Xcode 5 instruments CLI tool always runs Universal app in iPhone Simulator

Originator:jeff
Number:rdar://14136159 Date Originated:06.12.2013
Status:Duplicate/13607967 Resolved:
Product:Developer Tools Product Version:4.5 (46000)
Classification:Serious Bug Reproducible:Always
 
12-Jun-2013 05:21 PM Jeffrey Wear:
This is a duplicate of rdar://13607967. The following is copied from that Radar, lightly edited, with some additional notes at the end.

>>>>>>

Summary:

When launching UIAutomation tests in command line, the iPad simulator is always opened for Universal app, and  there is also no simple way to set the Simulator device type. One possible way is to force TARGETED_DEVICE_FAMILY at build time to force the Simulator to either be iPhone or iPad. But in this case, we can also not tell the Simulator to be 3.5" or 4", or Retina and Not retina for instance.

Steps to Reproduce:

1. Create a xcode project for an Universal app in Xcode 4.6.1.
2. Create some UIAutomation script for this project:
Test1.js:
  var testName = "Test 1";
  var target = UIATarget.localTarget();
  var app = target.frontMostApp();
  var window = app.mainWindow();

  UIALogger.logStart( testName );
  app.logElementTree();
  UIALogger.logStop( testName );
3. Launch the iOS Simulator with its device type set to "iPhone".
4. Launch instruments in command line for this script

instruments \
-t "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate" \
name_of_app \
-e UIASCRIPT absolute_path_to_the_test_file  

4. The Simulator changes to an iPad.

Expected Results:

There should be a way to precise which Simulator is launching at CLI for instruments.
Ideally, one could ask for "iPhone", "IPhone Retina 3.5", "iPhone Retina 4", "iPad", "iPad Retina", etc... 

Actual Results:

There is no simple way to set the Simulator device type when launched in CLI.

<<<<<<

Additional notes: it is possible to work around this issue by doing the following prior to testing:

1. building with an TARGETED_DEVICE_FAMILY override, and
2. GUI scripting the Simulator to set its device type

But it would be much more useful if instruments did not _at the least_ forcibly choose to run a Universal application using the iPad Simulator.

Beyond that, it would be nice if instruments could be invoked with a specific device type to remove the need to change the Simulator's device type, using GUI scripting, before running the tests.

Comments

This is resolved.

I can't log in and edit this issue for some reason, but it's resolved by instruments 5.1's ability to select the device type using the -w flag.

Still reproducible using Xcode 5.1 (5B130a), instruments 5.1 (55044)

Though again it's now the iPhone Simulator in which a Universal app always launches.

Problem is still reproducible using Xcode 5.1 beta 3

Though again it's now the iPhone Simulator in which a Universal app always launches.

Problem is still reproducible given Xcode 5 DP4 (5A11365j)

Though now it is the iPhone Simulator in which a Universal app always launches.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!