Changeset 204341 in webkit
- Timestamp:
- Aug 10, 2016 12:59:08 PM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r204332 r204341 1 2016-08-09 Simon Fraser <simon.fraser@apple.com> 2 3 Logging and other minor improvements to iOS webkitpy 4 https://bugs.webkit.org/show_bug.cgi?id=160722 5 6 Reviewed by Dan Bates. 7 8 Fix --debug-rwt-logging to log all the calls to simctl as well as device state information, 9 to make it easier to debug launching issues. 10 11 Have reset_preferences() reset the device, rather than just nuking the data 12 directory (which broke some versions of the simulator). 13 14 Make the Simulator.app launch in the background with open -g. 15 16 Wait for the simulator device to be in a known state in some more places. 17 18 * Scripts/webkitpy/port/ios.py: 19 (IOSSimulatorPort.setup_test_run): 20 (IOSSimulatorPort._quit_ios_simulator): 21 (IOSSimulatorPort.clean_up_test_run): 22 (IOSSimulatorPort.setup_environ_for_server): 23 (IOSSimulatorPort.reset_preferences): 24 * Scripts/webkitpy/xcode/simulator.py: 25 (Device.create): 26 (Device.delete): 27 (Device): 28 (Device.reset): 29 (Simulator.wait_until_device_is_booted): 30 (Simulator.wait_until_device_is_in_state): 31 (Simulator): 32 (Simulator.delete_device): 33 (Simulator.reset_device): 34 (Simulator.lookup_or_create_device): 35 1 36 2016-08-10 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 37 -
trunk/Tools/Scripts/webkitpy/port/ios.py
r204271 r204341 211 211 device_udid = self.testing_device(i).udid 212 212 # FIXME: <rdar://problem/20916140> Switch to using CoreSimulator.framework for launching and quitting iOS Simulator 213 213 214 self._executive.run_command([ 214 'open', '- b', self.SIMULATOR_BUNDLE_ID + str(i),215 'open', '-g', '-b', self.SIMULATOR_BUNDLE_ID + str(i), 215 216 '--args', '-CurrentDeviceUDID', device_udid]) 216 217 … … 223 224 224 225 def _quit_ios_simulator(self): 226 _log.debug("_quit_ios_simulator") 225 227 # FIXME: We should kill only the Simulators we started. 226 228 subprocess.call(["killall", "-9", "-m", "Simulator"]) … … 228 230 def clean_up_test_run(self): 229 231 super(IOSSimulatorPort, self).clean_up_test_run() 232 _log.debug("clean_up_test_run") 230 233 self._quit_ios_simulator() 231 234 fifos = [path for path in os.listdir('/tmp') if re.search('org.webkit.(DumpRenderTree|WebKitTestRunner).*_(IN|OUT|ERROR)', path)] … … 238 241 239 242 for i in xrange(self.child_processes()): 240 if not os.path.exists(self.get_simulator_path(i)): 243 simulator_path = self.get_simulator_path(i) 244 device_udid = self.testing_device(i).udid 245 if not os.path.exists(simulator_path): 241 246 continue 242 247 try: 243 subprocess.call([self.LSREGISTER_PATH, "-u", self.get_simulator_path(i)]) 244 shutil.rmtree(self.get_simulator_path(i), ignore_errors=True) 245 shutil.rmtree(os.path.join(os.path.expanduser("~"), "Library/Logs/CoreSimulator/", 246 self.testing_device(i).udid), ignore_errors=True) 247 shutil.rmtree(os.path.join(os.path.expanduser("~"), "Library/Saved Application State/", 248 self.SIMULATOR_BUNDLE_ID + str(i) + ".savedState"), ignore_errors=True) 249 Simulator().delete_device(self.testing_device(i).udid) 248 self._executive.run_command([self.LSREGISTER_PATH, "-u", simulator_path]) 249 250 _log.debug('rmtree %s', simulator_path) 251 self._filesystem.rmtree(simulator_path) 252 253 logs_path = self._filesystem.join(self._filesystem.expanduser("~"), "Library/Logs/CoreSimulator/", device_udid) 254 _log.debug('rmtree %s', logs_path) 255 self._filesystem.rmtree(logs_path) 256 257 saved_state_path = self._filesystem.join(self._filesystem.expanduser("~"), "Library/Saved Application State/", self.SIMULATOR_BUNDLE_ID + str(i) + ".savedState") 258 _log.debug('rmtree %s', saved_state_path) 259 self._filesystem.rmtree(saved_state_path) 260 261 Simulator().delete_device(device_udid) 250 262 except: 251 263 _log.warning('Unable to remove Simulator' + str(i)) 252 264 253 265 def setup_environ_for_server(self, server_name=None): 266 _log.debug("setup_environ_for_server") 254 267 env = super(IOSSimulatorPort, self).setup_environ_for_server(server_name) 255 268 if server_name == self.driver_name(): … … 337 350 338 351 def reset_preferences(self): 352 _log.debug("reset_preferences") 339 353 if (self.default_child_processes() < self.child_processes()): 340 354 _log.warn("You have specified very high value({0}) for --child-processes".format(self.child_processes())) … … 347 361 for i in xrange(self.child_processes()): 348 362 Simulator.wait_until_device_is_in_state(self.testing_device(i).udid, Simulator.DeviceState.SHUTDOWN) 349 350 data_path = os.path.join(self.testing_device(i).path, 'data') 351 if os.path.isdir(data_path): 352 shutil.rmtree(data_path) 363 Simulator.reset_device(self.testing_device(i).udid) 353 364 354 365 def nm_command(self): -
trunk/Tools/Scripts/webkitpy/xcode/simulator.py
r202362 r204341 214 214 """ 215 215 device_udid = subprocess.check_output(['xcrun', 'simctl', 'create', name, device_type.identifier, runtime.identifier]).rstrip() 216 _log.debug('"xcrun simctl create %s %s %s" returned %s', name, device_type.identifier, runtime.identifier, device_udid) 216 217 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN) 217 218 return Simulator().find_device_by_udid(device_udid) … … 224 225 :type udid: str 225 226 """ 226 subprocess.call(['xcrun', 'simctl', 'delete', udid]) 227 _log.debug('deleting device %s', udid) 228 Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.SHUTDOWN) 229 try: 230 _log.debug('xcrun simctl delete %s', udid) 231 subprocess.check_call(['xcrun', 'simctl', 'delete', udid]) 232 except subprocess.CalledProcessError: 233 raise RuntimeError('"xcrun simctl delete" failed: device state is {}'.format(Simulator.device_state(udid))) 234 235 @classmethod 236 def reset(cls, udid): 237 """ 238 Reset the given CoreSimulator device. 239 :param udid: The udid of the device. 240 :type udid: str 241 """ 242 _log.debug('resetting device %s', udid) 243 Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.SHUTDOWN) 244 try: 245 _log.debug('xcrun simctl erase %s', udid) 246 subprocess.check_call(['xcrun', 'simctl', 'erase', udid]) 247 except subprocess.CalledProcessError: 248 raise RuntimeError('"xcrun simctl erase" failed: device state is {}'.format(Simulator.device_state(udid))) 227 249 228 250 def __eq__(self, other): … … 282 304 try: 283 305 state = subprocess.check_output(['xcrun', 'simctl', 'spawn', udid, 'launchctl', 'print', 'system']).strip() 306 _log.debug('xcrun simctl spawn %s', udid) 307 284 308 if re.search("A[\s]+com.apple.springboard.services", state): 285 309 return … … 292 316 @staticmethod 293 317 def wait_until_device_is_in_state(udid, wait_until_state, timeout_seconds=60 * 5): 318 _log.debug('waiting for device %s to enter state %s with timeout %s', udid, wait_until_state, timeout_seconds) 294 319 with timeout(seconds=timeout_seconds): 295 while (Simulator.device_state(udid) != wait_until_state): 320 device_state = Simulator.device_state(udid) 321 while (device_state != wait_until_state): 322 device_state = Simulator.device_state(udid) 323 _log.debug(' device state %s', device_state) 296 324 time.sleep(0.5) 325 326 end_state = Simulator.device_state(udid) 327 if (end_state != wait_until_state): 328 raise RuntimeError('Timed out waiting for simulator device to enter state {0}; current state is {1}'.format(wait_until_state, end_state)) 297 329 298 330 @staticmethod … … 307 339 return os.path.realpath(os.path.expanduser(os.path.join('~/Library/Developer/CoreSimulator/Devices', udid))) 308 340 309 def delete_device(self, udid):310 Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.SHUTDOWN)341 @staticmethod 342 def delete_device(udid): 311 343 Device.delete(udid) 344 345 @staticmethod 346 def reset_device(udid): 347 Device.reset(udid) 312 348 313 349 def refresh(self): … … 513 549 testing_device = self.device(name=name, runtime=runtime, should_ignore_unavailable_devices=True) 514 550 if testing_device: 551 _log.debug('lookup_or_create_device %s %s %s found %s', name, device_type, runtime, testing_device.name) 515 552 return testing_device 516 553 testing_device = Device.create(name, device_type, runtime) 554 _log.debug('lookup_or_create_device %s %s %s created %s', name, device_type, runtime, testing_device.name) 517 555 assert(testing_device.available) 518 556 return testing_device
Note: See TracChangeset
for help on using the changeset viewer.