Changeset 209136 in webkit
- Timestamp:
- Nov 30, 2016 10:30:47 AM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r209090 r209136 1 2016-11-30 Jonathan Bedard <jbedard@apple.com> 2 3 Make it possible to use an existing simulator instance for one-off testing 4 https://bugs.webkit.org/show_bug.cgi?id=164568 5 <rdar://problem/29189133> 6 7 Reviewed by Daniel Bates. 8 9 With this patch, if a simulator is currently running on the machine and 10 '--dedicated-simulators' is not passed into the application, only one simulator 11 instance will be used, and this instance will be the existing instance. 12 If no simulator is running or '--dedicated-simulators' is passed to the script, 13 previous behavior will be used. 14 15 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 16 (parse_args): 17 * Scripts/webkitpy/port/ios.py: 18 (IOSSimulatorPort.__init__): Logic for enabling usage of currently running simulator. 19 (IOSSimulatorPort._create_simulators): Only create simulators when needed, don't reset already running simulators. 20 (IOSSimulatorPort.setup_test_run): Don't open already running simulators. 21 (IOSSimulatorPort._quit_ios_simulator): Only quit simulators if we manage them. 22 (IOSSimulatorPort.clean_up_test_run): Only clean up simulators if we manage them. 23 (IOSSimulatorPort._using_dedicated_simulators): True if simulators need to be managed, false if using an existing instance. 24 (IOSSimulatorPort.device_id_for_worker_number): Access currently running simulator if not managing devices. 25 * Scripts/webkitpy/xcode/simulator.py: 26 (Simulator.current_device): Get currently running device. 27 1 28 2016-11-29 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 29 -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r205351 r209136 297 297 optparse.make_option('--runtime', help='iOS Simulator runtime identifier (default: latest runtime)'), 298 298 optparse.make_option('--device-type', help='iOS Simulator device type identifier (default: i386 -> iPhone 5, x86_64 -> iPhone 5s)'), 299 optparse.make_option('--dedicated-simulators', action="store_true", default=False, 300 help="If set, dedicated iOS simulators will always be created. If not set, the script will attempt to use any currently running simulator."), 299 301 ])) 300 302 -
trunk/Tools/Scripts/webkitpy/port/ios.py
r208430 r209136 104 104 _log.debug('IOSSimulatorPort _device_class is %s', self._device_class) 105 105 106 self._current_device = Simulator().current_device() 107 if not self._current_device: 108 self.set_option('dedicated_simulators', True) 109 if not self.get_option('dedicated_simulators'): 110 if self.get_option('child_processes') > 1: 111 _log.warn('Cannot have more than one child process when using a running simulator. Setting child_processes to 1.') 112 self.set_option('child_processes', 1) 113 106 114 def driver_name(self): 107 115 if self.get_option('driver_name'): … … 277 285 _log.warn("This is very likely to fail.") 278 286 279 self._createSimulatorApps() 280 281 for i in xrange(self.child_processes()): 282 self._create_device(i) 283 284 for i in xrange(self.child_processes()): 285 device_udid = self._testing_device(i).udid 286 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN) 287 Simulator.reset_device(device_udid) 287 if self._using_dedicated_simulators(): 288 self._createSimulatorApps() 289 290 for i in xrange(self.child_processes()): 291 self._create_device(i) 292 293 for i in xrange(self.child_processes()): 294 device_udid = self._testing_device(i).udid 295 Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN) 296 Simulator.reset_device(device_udid) 297 else: 298 assert(self._current_device) 299 if self._current_device.name != self.simulator_device_type().name: 300 _log.warn("Expected simulator of type '" + self.simulator_device_type().name + "' but found simulator of type '" + self._current_device.name + "'") 301 _log.warn('The next block of tests may fail due to device mis-match') 288 302 289 303 def setup_test_run(self, device_class=None): … … 296 310 297 311 self._create_simulators() 312 313 if not self._using_dedicated_simulators(): 314 return 298 315 299 316 for i in xrange(self.child_processes()): … … 314 331 315 332 def _quit_ios_simulator(self): 333 if not self._using_dedicated_simulators(): 334 return 316 335 _log.debug("_quit_ios_simulator killing all Simulator processes") 317 336 # FIXME: We should kill only the Simulators we started. … … 329 348 _log.warning('Unable to remove ' + fifo) 330 349 pass 350 351 if not self._using_dedicated_simulators(): 352 return 331 353 332 354 for i in xrange(self.child_processes()): … … 380 402 SUBPROCESS_CRASH_REGEX = re.compile('#CRASHED - (?P<subprocess_name>\S+) \(pid (?P<subprocess_pid>\d+)\)') 381 403 404 def _using_dedicated_simulators(self): 405 return self.get_option('dedicated_simulators') 406 382 407 def _create_device(self, number): 383 408 return Simulator.create_device(number, self.simulator_device_type(), self.simulator_runtime) … … 393 418 if self._printing_cmd_line: 394 419 return '<dummy id>' 395 return self._testing_device(number).udid 420 if self._using_dedicated_simulators(): 421 return self._testing_device(number).udid 422 return self._current_device.udid 396 423 397 424 def get_simulator_path(self, suffix=""): -
trunk/Tools/Scripts/webkitpy/xcode/simulator.py
r204680 r209136 530 530 return None 531 531 532 def current_device(self): 533 # FIXME: Find the simulator device that was booted by Simulator.app. For now, pick some booted simulator device, which 534 # may have been booted using the simctl command line tool. 535 for device in self.devices: 536 if device.state == Simulator.DeviceState.BOOTED: 537 return device 538 return None 539 532 540 # FIXME: We should find an existing device with respect to its name, device type and runtime. 533 541 def device(self, name=None, runtime=None, should_ignore_unavailable_devices=False):
Note: See TracChangeset
for help on using the changeset viewer.