Modified: trunk/Tools/ChangeLog (238102 => 238103)
--- trunk/Tools/ChangeLog 2018-11-12 19:49:13 UTC (rev 238102)
+++ trunk/Tools/ChangeLog 2018-11-12 19:59:34 UTC (rev 238103)
@@ -1,3 +1,26 @@
+2018-11-12 Jonathan Bedard <[email protected]>
+
+ webkitpy: Check for specific process instead of using data migrator
+ https://bugs.webkit.org/show_bug.cgi?id=191551
+ <rdar://problem/45993156>
+
+ Rubber-stamped by Aakash Jain.
+
+ It's possible for the data migrator process to be stuck, but for a simulator to be
+ usable. Use device-specific processes to detect when a device is usable.
+
+ * Scripts/webkitpy/xcode/simulated_device.py:
+ (SimulatedDeviceManager._wait_until_device_is_usable):
+ (SimulatedDeviceManager):
+ (SimulatedDeviceManager.initialize_devices): Explicitly wait until a device is usable
+ since this implies that a device is booted.
+ (SimulatedDeviceManager.swap): Ditto.
+ (SimulatedDevice.is_usable): Check that a device is booted and that a device-specific
+ process indicating the device is usable can be found.
+ (SimulatedDeviceManager.wait_until_data_migration_is_done): Deleted.
+ * Scripts/webkitpy/xcode/simulated_device_unittest.py: Update simctl_json so that
+ it triggers the logic in is_usable()
+
2018-11-12 Takashi Komori <[email protected]>
Resurrect WebKitTestRunner for Windows port
Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (238102 => 238103)
--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2018-11-12 19:49:13 UTC (rev 238102)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2018-11-12 19:59:34 UTC (rev 238103)
@@ -309,6 +309,14 @@
raise RuntimeError('Timed out while waiting for all devices to boot')
@staticmethod
+ def _wait_until_device_is_usable(device, deadline):
+ _log.debug('Waiting until {} is usable'.format(device))
+ while not device.platform_device.is_usable(force_update=True):
+ if time.time() > deadline:
+ raise RuntimeError('Timed out while waiting for {} to become usable'.format(device))
+ time.sleep(1)
+
+ @staticmethod
def _boot_device(device, host=SystemHost()):
_log.debug("Booting device '{}'".format(device.udid))
device.platform_device.booted_by_script = True
@@ -366,8 +374,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()))
+ SimulatedDeviceManager._wait_until_device_is_usable(device, deadline)
return SimulatedDeviceManager.INITIALIZED_DEVICES
@@ -417,20 +424,9 @@
SimulatedDeviceManager.INITIALIZED_DEVICES[index] = device
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()))
+ SimulatedDeviceManager._wait_until_device_is_usable(device, max(0, deadline - time.time()))
@staticmethod
- def wait_until_data_migration_is_done(host, timeout=SIMULATOR_BOOT_TIMEOUT):
- # 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)
@@ -498,6 +494,23 @@
return True
return False
+ def is_usable(self, force_update=False):
+ if self.state(force_update=force_update) != SimulatedDevice.DeviceState.BOOTED:
+ return False
+
+ if self.device_type.software_variant == 'iOS':
+ home_screen_service = 'com.apple.springboard.services'
+ elif self.device_type.software_version == 'watchOS':
+ home_screen_service = 'com.apple.carousel.sessionservice'
+ else:
+ _log.debug('{} has no service to check if the device is usable'.format(self.device_type.software_variant))
+ return True
+
+ for line in self.executive.run_command([SimulatedDeviceManager.xcrun, 'simctl', 'spawn', self.udid, 'launchctl', 'print', 'system']).splitlines():
+ if home_screen_service in line:
+ return True
+ return False
+
def _shut_down(self, timeout=10.0):
deadline = time.time() + timeout
Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py (238102 => 238103)
--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py 2018-11-12 19:49:13 UTC (rev 238102)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py 2018-11-12 19:59:34 UTC (rev 238103)
@@ -487,7 +487,12 @@
},
"state" : "(active, disconnected)"
}
- }
+ },
+ "services" : [
+ "This triggers the bail-out logic in SimulatedDevice.is_usable()",
+ "com.apple.springboard.services",
+ "com.apple.carousel.sessionservice"
+ ]
}"""
import json