Changeset 179712 in webkit
- Timestamp:
- Feb 5, 2015, 2:46:30 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/port/ios.py (modified) (3 diffs)
-
Scripts/webkitpy/xcode/simulator.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r179698 r179712 1 2015-02-05 Daniel Bates <dabates@apple.com> 2 3 LayoutTestRelay does not install DumpRenderTree.app/WebKitTestRunnerApp.app 4 https://bugs.webkit.org/show_bug.cgi?id=139746 5 <rdar://problem/19283658> 6 7 Reviewed by Alexey Proskuryakov. 8 9 Fixes an issues where LayoutTestRelay may fail to install DumpRenderTree.app/WebKitTestRunnerApp.app 10 if the simulator device is not in state Booted. 11 12 Currently run-webkit-test --ios-sim executes LayoutTestRelay immediately after 13 launching/relaunching the iOS Simulator app and a simulator app can only be installed 14 on a device that is in the Booted state. LayoutTestRelay may run before the 15 device is booted and hence fail to install DumpRenderTree.app/WebKitTestRunnerApp.app. 16 We should defer executing LayoutTestRelay until the simulator device booted by 17 iOS Simulator is in the Booted state. 18 19 * Scripts/webkitpy/port/ios.py: Import webkitpy.xcode.simulator.Simulator to avoid prefixing 20 Simulator methods with the module name, simulator. 21 (IOSSimulatorPort.setup_test_run): Wait for the simulator device to be in the Booted state 22 after launching iOS Simulator. Also, wait until the simulator device is in the Shutdown state 23 before launching iOS Simulator to boot it. 24 (IOSSimulatorPort.testing_device): Fix up caller since we now import webkitpy.xcode.simulator.Simulator. 25 (IOSSimulatorPort.simulator_path): Deleted; moved this function to class Simulator and renamed to device_directory(). 26 * Scripts/webkitpy/xcode/simulator.py: 27 (Device.__init__): Remove parameter state and an instance variable of the same name, which represented 28 the state of the device when we created this object as part of parsing the output of `simctl list`. Callers 29 interested in the state of the device are more likely interested in the current state of the device as 30 opposed to the state of the device when the Device object was created. 31 (Device.state): Added; turn around and call Simulator.device_state() for the current state of the device. 32 (Device.path): Extracted implementation into Simulator.device_directory() so that it can be called 33 from both this function and Simulator.device_state(). 34 (Device.create): Use Simulator.wait_until_device_is_in_state() to simplify the implementation of this function. 35 (Simulator.DeviceState): Added; class of constants. 36 (Simulator.wait_until_device_is_in_state): Added; this function does not return until the specified 37 device is in the specified state. 38 (Simulator.device_state): Added; parses the state of the device from the appropriate CoreSimulator device.plist file. 39 (Simulator.device_directory): Added. 40 (Simulator._parse_devices): Do not pass argument state to Device constructor as it no longer accepts it. 41 1 42 2015-02-05 Alexey Proskuryakov <ap@apple.com> 2 43 -
trunk/Tools/Scripts/webkitpy/port/ios.py
r179629 r179712 37 37 from webkitpy.port.leakdetector import LeakDetector 38 38 from webkitpy.port import config as port_config 39 from webkitpy.xcode import simulator39 from webkitpy.xcode.simulator import Simulator 40 40 41 41 … … 180 180 def setup_test_run(self): 181 181 self._executive.run_command(['osascript', '-e', 'tell application "iOS Simulator" to quit']) 182 time.sleep(2) 182 device_udid = self.testing_device.udid 183 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN) 183 184 self._executive.run_command([ 184 185 'open', '-a', os.path.join(self.developer_dir, 'Applications', 'iOS Simulator.app'), 185 '--args', '-CurrentDeviceUDID', self.testing_device.udid]) 186 '--args', '-CurrentDeviceUDID', device_udid]) 187 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.BOOTED) 186 188 187 189 def clean_up_test_run(self): … … 288 290 device_type = self.get_option('device_type') 289 291 runtime = self.get_option('runtime') 290 self._testing_device = simulator.Simulator().lookup_or_create_device(device_type.name + ' WebKit Tester', device_type, runtime)292 self._testing_device = Simulator().lookup_or_create_device(device_type.name + ' WebKit Tester', device_type, runtime) 291 293 return self.testing_device 292 293 def simulator_path(self, udid):294 if udid:295 return os.path.realpath(os.path.expanduser(os.path.join('~/Library/Developer/CoreSimulator/Devices', udid)))296 294 297 295 def look_for_new_crash_logs(self, crashed_processes, start_time): -
trunk/Tools/Scripts/webkitpy/xcode/simulator.py
r178925 r179712 2 2 import logging 3 3 import os 4 import plistlib 4 5 import re 5 6 import subprocess … … 14 15 Do not use PyObjC to dlopen the framework. 15 16 """ 16 17 17 18 18 class DeviceType(object): … … 141 141 """ 142 142 143 def __init__(self, name, udid, state,available, runtime):143 def __init__(self, name, udid, available, runtime): 144 144 """ 145 145 :param name: The device name … … 147 147 :param udid: The device UDID (a UUID string) 148 148 :type udid: str 149 :param state: The last known device state150 :type state: str151 149 :param available: Whether the device is available for use. 152 150 :type available: bool … … 156 154 self.name = name 157 155 self.udid = udid 158 self.state = state159 156 self.available = available 160 157 self.runtime = runtime 161 158 162 159 @property 160 def state(self): 161 """ 162 :returns: The current state of the device. 163 :rtype: Simulator.DeviceState 164 """ 165 return Simulator.device_state(self.udid) 166 167 @property 163 168 def path(self): 164 169 """ … … 166 171 :rtype: str 167 172 """ 168 return os.path.realpath( 169 os.path.expanduser( 170 os.path.join('~/Library/Developer/CoreSimulator/Devices', self.udid))) 173 return Simulator.device_directory(self.udid) 171 174 172 175 @classmethod … … 183 186 :rtype: Device 184 187 """ 185 sim = Simulator()186 188 device_udid = subprocess.check_output(['xcrun', 'simctl', 'create', name, device_type.identifier, runtime.identifier]).rstrip() 187 assert(device_udid) 188 while True: 189 sim.refresh() 190 device = sim.find_device_by_udid(device_udid) 191 if not device or device.state == 'Creating': 192 time.sleep(2) 193 continue 194 return device 189 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN) 190 return Simulator().find_device_by_udid(device_udid) 195 191 196 192 def __eq__(self, other): … … 228 224 self.device_types = [] 229 225 self.refresh() 226 227 # Keep these constants synchronized with the SimDeviceState constants in CoreSimulator/SimDevice.h. 228 class DeviceState: 229 DOES_NOT_EXIST = -1 230 CREATING = 0 231 SHUTDOWN = 1 232 BOOTING = 2 233 BOOTED = 3 234 SHUTTING_DOWN = 4 235 236 @staticmethod 237 def wait_until_device_is_in_state(udid, wait_until_state): 238 # FIXME: Implement support for a timed wait. 239 while (Simulator.device_state(udid) != wait_until_state): 240 time.sleep(0.5) 241 242 @staticmethod 243 def device_state(udid): 244 device_plist = os.path.join(Simulator.device_directory(udid), 'device.plist') 245 if not os.path.isfile(device_plist): 246 return Simulator.DeviceState.DOES_NOT_EXIST 247 return plistlib.readPlist(device_plist)['state'] 248 249 @staticmethod 250 def device_directory(udid): 251 return os.path.realpath(os.path.expanduser(os.path.join('~/Library/Developer/CoreSimulator/Devices', udid))) 230 252 231 253 def refresh(self): … … 306 328 device = Device(name=device_match.group('name').rstrip(), 307 329 udid=device_match.group('udid'), 308 state=device_match.group('state'),309 330 available=device_match.group('availability') is None, 310 331 runtime=current_runtime)
Note:
See TracChangeset
for help on using the changeset viewer.