Modified: trunk/Tools/ChangeLog (231451 => 231452)
--- trunk/Tools/ChangeLog 2018-05-07 19:42:54 UTC (rev 231451)
+++ trunk/Tools/ChangeLog 2018-05-07 20:08:16 UTC (rev 231452)
@@ -1,3 +1,26 @@
+2018-05-07 Jonathan Bedard <[email protected]>
+
+ Check for com.apple.datamigrator before declaring simulators booted
+ https://bugs.webkit.org/show_bug.cgi?id=185315
+ <rdar://problem/39986261>
+
+ Reviewed by David Kilzer.
+
+ * Scripts/webkitdirs.pm:
+ (waitUntilProcessNotRunning): Wait until a process is not found.
+ (relaunchIOSSimulator): Wait until com.apple.datamigrator stops running to declare
+ a simulator booted.
+ * Scripts/webkitpy/common/system/executive_mock.py:
+ (MockExecutive2.__init__): Define _running_pids.
+ * Scripts/webkitpy/xcode/simulated_device.py:
+ (SimulatedDeviceManager.initialize_devices): Call wait_until_data_migration_is_done before
+ declaring that devices have been booted, increase the timeout since data migration will frequently
+ take longer than 60 seconds, especially with multiple simulators booting.
+ (SimulatedDeviceManager.swap): Ditto.
+ (SimulatedDeviceManager):
+ (SimulatedDeviceManager.wait_until_data_migration_is_done): Wait until there are no com.apple.datamigrator
+ processes running.
+
2018-05-07 Daniel Bates <[email protected]>
REGRESSION (r229955): run-webkit-tests runs tests in skipped directories and subdirectories of directory given on command line
Modified: trunk/Tools/Scripts/webkitdirs.pm (231451 => 231452)
--- trunk/Tools/Scripts/webkitdirs.pm 2018-05-07 19:42:54 UTC (rev 231451)
+++ trunk/Tools/Scripts/webkitdirs.pm 2018-05-07 20:08:16 UTC (rev 231452)
@@ -2451,6 +2451,14 @@
}
}
+sub waitUntilProcessNotRunning($)
+{
+ my ($process) = @_;
+ while (system("/bin/ps -eo pid,comm | /usr/bin/grep '$process\$'") == 0) {
+ usleep(500 * 1000);
+ }
+}
+
sub shutDownIOSSimulatorDevice($)
{
my ($simulatorDevice) = @_;
@@ -2476,6 +2484,7 @@
system("open", "-a", $iosSimulatorPath, "--args", "-CurrentDeviceUDID", $simulatedDevice->{UDID}) == 0 or die "Failed to open $iosSimulatorPath: $!";
waitUntilIOSSimulatorDeviceIsInState($simulatedDevice->{UDID}, SIMULATOR_DEVICE_STATE_BOOTED);
+ waitUntilProcessNotRunning("com.apple.datamigrator");
}
sub quitIOSSimulator(;$)
Modified: trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py (231451 => 231452)
--- trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py 2018-05-07 19:42:54 UTC (rev 231451)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive_mock.py 2018-05-07 20:08:16 UTC (rev 231452)
@@ -178,6 +178,7 @@
self._stderr = stderr
self._exit_code = exit_code
self._exception = exception
+ self._running_pids = {'test-webkitpy': os.getpid()}
self._run_command_fn = run_command_fn
self.calls = []
Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (231451 => 231452)
--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2018-05-07 19:42:54 UTC (rev 231451)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2018-05-07 20:08:16 UTC (rev 231452)
@@ -314,7 +314,7 @@
SimulatedDeviceManager.INITIALIZED_DEVICES.append(device)
@staticmethod
- def initialize_devices(requests, host=SystemHost(), name_base='Managed', simulator_ui=True, timeout=60, **kwargs):
+ def initialize_devices(requests, host=SystemHost(), name_base='Managed', simulator_ui=True, timeout=180, **kwargs):
if SimulatedDeviceManager.INITIALIZED_DEVICES is not None:
return SimulatedDeviceManager.INITIALIZED_DEVICES
@@ -365,6 +365,7 @@
deadline = time.time() + timeout
for device in SimulatedDeviceManager.INITIALIZED_DEVICES:
SimulatedDeviceManager._wait_until_device_in_state(device, SimulatedDevice.DeviceState.BOOTED, deadline)
+ SimulatedDeviceManager.wait_until_data_migration_is_done(host, max(0, deadline - time.time()))
return SimulatedDeviceManager.INITIALIZED_DEVICES
@@ -394,7 +395,7 @@
return min(max_supported_simulators_locally, max_supported_simulators_for_hardware)
@staticmethod
- def swap(device, request, host=SystemHost(), name_base='Managed', timeout=60):
+ def swap(device, request, host=SystemHost(), name_base='Managed', timeout=180):
if SimulatedDeviceManager.INITIALIZED_DEVICES is None:
raise RuntimeError('Cannot swap when there are no initialized devices')
if device not in SimulatedDeviceManager.INITIALIZED_DEVICES:
@@ -415,8 +416,19 @@
deadline = time.time() + timeout
SimulatedDeviceManager._wait_until_device_in_state(device, SimulatedDevice.DeviceState.BOOTED, deadline)
+ SimulatedDeviceManager.wait_until_data_migration_is_done(host, max(0, deadline - time.time()))
@staticmethod
+ def wait_until_data_migration_is_done(host, timeout=180):
+ # The existence of a datamigrator process means that simulators are still booting.
+ deadline = time.time() + timeout
+ _log.debug('Waiting until no com.apple.datamigrator processes are found')
+ while host.executive.running_pids(lambda process_name: 'com.apple.datamigrator' in process_name):
+ if time.time() > deadline:
+ raise RuntimeError('Timed out while waiting for data migration')
+ time.sleep(1)
+
+ @staticmethod
def tear_down(host=SystemHost(), timeout=60):
if SimulatedDeviceManager._managing_simulator_app:
host.executive.run_command(['killall', '-9', 'Simulator'], return_exit_code=True)