Title: [201986] trunk/Tools
Revision
201986
Author
aakash_j...@apple.com
Date
2016-06-12 20:57:23 -0700 (Sun, 12 Jun 2016)

Log Message

run-safari/run-webkit-app fail to quit iOS simulator after Xcode installation
https://bugs.webkit.org/show_bug.cgi?id=158651
rdar://problem/26499824

Reviewed by Daniel Bates.

This change is to make our tools more robust. Sometimes run-safari/run-webkit-app fails
to start the tests as one of the first thing these scripts do is to relaunch iOS Simulators,
and in process call quitIOSSimulator. In case the Simulator is not registered in LaunchServices
for some reason, quitIOSSimulator fails and the script stops. This change will make the scripts
still continue when they fail to quit iOS Simuator, and modify the way Simulator is opened,
so that Simulator is implicitly registered with LaunchServices while opening it.

* Scripts/webkitdirs.pm:
(relaunchIOSSimulator):
Launch iOS Simulator using complete path. Partially reverting http://trac.webkit.org/changeset/184202.
(quitIOSSimulator):
Do not die if quitting ios Simulator fails, so that relaunchIOSSimulator can still
attempt to launch the simulator.
(waitUntilIOSSimulatorDeviceIsInState):
Added a FIXME.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (201985 => 201986)


--- trunk/Tools/ChangeLog	2016-06-12 20:57:11 UTC (rev 201985)
+++ trunk/Tools/ChangeLog	2016-06-13 03:57:23 UTC (rev 201986)
@@ -1,3 +1,27 @@
+2016-06-12  Aakash Jain  <aakash_j...@apple.com>
+
+        run-safari/run-webkit-app fail to quit iOS simulator after Xcode installation
+        https://bugs.webkit.org/show_bug.cgi?id=158651
+        rdar://problem/26499824
+
+        Reviewed by Daniel Bates.
+
+        This change is to make our tools more robust. Sometimes run-safari/run-webkit-app fails 
+        to start the tests as one of the first thing these scripts do is to relaunch iOS Simulators,
+        and in process call quitIOSSimulator. In case the Simulator is not registered in LaunchServices
+        for some reason, quitIOSSimulator fails and the script stops. This change will make the scripts
+        still continue when they fail to quit iOS Simuator, and modify the way Simulator is opened, 
+        so that Simulator is implicitly registered with LaunchServices while opening it.
+
+        * Scripts/webkitdirs.pm:
+        (relaunchIOSSimulator):
+        Launch iOS Simulator using complete path. Partially reverting http://trac.webkit.org/changeset/184202.
+        (quitIOSSimulator):
+        Do not die if quitting ios Simulator fails, so that relaunchIOSSimulator can still 
+        attempt to launch the simulator.
+        (waitUntilIOSSimulatorDeviceIsInState):
+        Added a FIXME.
+
 2016-06-11  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Addressing post-review comments after r201978.

Modified: trunk/Tools/Scripts/webkitdirs.pm (201985 => 201986)


--- trunk/Tools/Scripts/webkitdirs.pm	2016-06-12 20:57:11 UTC (rev 201985)
+++ trunk/Tools/Scripts/webkitdirs.pm	2016-06-13 03:57:23 UTC (rev 201986)
@@ -2252,6 +2252,7 @@
 {
     my ($deviceUDID, $waitUntilState) = @_;
     my $device = iosSimulatorDeviceByUDID($deviceUDID);
+    # FIXME: We should add a maximum time limit to wait here.
     while ($device->{state} ne $waitUntilState) {
         usleep(500 * 1000); # Waiting 500ms between file system polls does not make script run-safari feel sluggish.
         $device = iosSimulatorDeviceByUDID($deviceUDID);
@@ -2278,8 +2279,9 @@
     quitIOSSimulator($simulatedDevice->{UDID});
 
     # FIXME: <rdar://problem/20916140> Switch to using CoreSimulator.framework for launching and quitting iOS Simulator
-    my $iosSimulatorBundleID = "com.apple.iphonesimulator";
-    system("open", "-b", $iosSimulatorBundleID, "--args", "-CurrentDeviceUDID", $simulatedDevice->{UDID}) == 0 or die "Failed to open $iosSimulatorBundleID: $!";
+    chomp(my $developerDirectory = $ENV{DEVELOPER_DIR} || `xcode-select --print-path`); 
+    my $iosSimulatorPath = File::Spec->catfile($developerDirectory, "Applications", "Simulator.app"); 
+    system("open", "-a", $iosSimulatorPath, "--args", "-CurrentDeviceUDID", $simulatedDevice->{UDID}) == 0 or die "Failed to open $iosSimulatorPath: $!"; 
 
     waitUntilIOSSimulatorDeviceIsInState($simulatedDevice->{UDID}, SIMULATOR_DEVICE_STATE_BOOTED);
 }
@@ -2288,7 +2290,11 @@
 {
     my ($waitForShutdownOfSimulatedDeviceUDID) = @_;
     # FIXME: <rdar://problem/20916140> Switch to using CoreSimulator.framework for launching and quitting iOS Simulator
-    exitStatus(system {"osascript"} "osascript", "-e", 'tell application id "com.apple.iphonesimulator" to quit') == 0 or die "Failed to quit iOS Simulator: $!";
+    if (exitStatus(system {"osascript"} "osascript", "-e", 'tell application id "com.apple.iphonesimulator" to quit')) {
+        # osascript returns a non-zero exit status if Simulator.app is not registered in LaunchServices.
+        return;
+    }
+
     if (!defined($waitForShutdownOfSimulatedDeviceUDID)) {
         return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to