Changeset 180239 in webkit


Ignore:
Timestamp:
Feb 17, 2015 2:30:07 PM (9 years ago)
Author:
dbates@webkit.org
Message:

[iOS] run-webkit-tests should check that simctl can boot and shutdown simulator device before running tests
https://bugs.webkit.org/show_bug.cgi?id=141718

Reviewed by Alex Christensen.

We should only run layout tests if simctl can successfully boot and shutdown the testing device.

  • Scripts/webkitpy/port/ios.py:

(IOSSimulatorPort.check_sys_deps): Modified to call Simulator.check_simulator_device_and_erase_if_needed().
Log a error and return False if we are unable to boot the simulator device so that the caller can take
appropriate action, say exit(3) before running any layout tests.

  • Scripts/webkitpy/xcode/simulator.py:

(Simulator._boot_and_shutdown_simulator_device): Added. Boot and then shut down the simulator device
with the specified UDID.
(Simulator.check_simulator_device_and_erase_if_needed): Added. Checks that simulator device
with the specified UDID can successfully boot and shut down. We make at most two attempts to
boot and shut down the device, erasing the device between tries so as to restore the device
to a known good state.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r180238 r180239  
     12015-02-17  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] run-webkit-tests should check that simctl can boot and shutdown simulator device before running tests
     4        https://bugs.webkit.org/show_bug.cgi?id=141718
     5
     6        Reviewed by Alex Christensen.
     7
     8        We should only run layout tests if simctl can successfully boot and shutdown the testing device.
     9
     10        * Scripts/webkitpy/port/ios.py:
     11        (IOSSimulatorPort.check_sys_deps): Modified to call Simulator.check_simulator_device_and_erase_if_needed().
     12        Log a error and return False if we are unable to boot the simulator device so that the caller can take
     13        appropriate action, say exit(3) before running any layout tests.
     14        * Scripts/webkitpy/xcode/simulator.py:
     15        (Simulator._boot_and_shutdown_simulator_device): Added. Boot and then shut down the simulator device
     16        with the specified UDID.
     17        (Simulator.check_simulator_device_and_erase_if_needed): Added. Checks that simulator device
     18        with the specified UDID can successfully boot and shut down. We make at most two attempts to
     19        boot and shut down the device, erasing the device between tries so as to restore the device
     20        to a known good state.
     21
    1222015-02-17  Daniel Bates  <dabates@apple.com>
    223
  • trunk/Tools/Scripts/webkitpy/port/ios.py

    r180238 r180239  
    240240            _log.error('The iOS Simulator runtime with identifier "{0}" cannot be used because it is unavailable.'.format(self.simulator_runtime.identifier))
    241241            return False
     242        testing_device = self.testing_device  # May create a new simulator device
     243        if not Simulator.check_simulator_device_and_erase_if_needed(self.host, testing_device.udid):
     244            _log.error('Unable to boot the simulator device with UDID {0}.'.format(testing_device.udid))
     245            return False
    242246        return super(IOSSimulatorPort, self).check_sys_deps(needs_http)
    243247
  • trunk/Tools/Scripts/webkitpy/xcode/simulator.py

    r180238 r180239  
    278278        return os.path.realpath(os.path.expanduser(os.path.join('~/Library/Developer/CoreSimulator/Devices', udid)))
    279279
     280    @staticmethod
     281    def _boot_and_shutdown_simulator_device(host, udid):
     282        exit_code = host.executive.run_command(['xcrun', 'simctl', 'boot', udid], return_exit_code=True)
     283        if exit_code:
     284            return exit_code
     285        exit_code = host.executive.run_command(['xcrun', 'simctl', 'shutdown', udid], return_exit_code=True)
     286        return exit_code
     287
     288    @staticmethod
     289    def check_simulator_device_and_erase_if_needed(host, udid):
     290        exit_code = Simulator._boot_and_shutdown_simulator_device(host, udid)
     291        if not exit_code:
     292            return True  # Can boot device
     293        # Try erasing the simulator device to restore it to a known good state.
     294        if not host.executive.run_command(['xcrun', 'simctl', 'erase', udid], return_exit_code=True):
     295            return Simulator._boot_and_shutdown_simulator_device(host, udid) == 0  # Can boot device
     296        return False  # Cannot boot or erase device
     297
    280298    def refresh(self):
    281299        """
Note: See TracChangeset for help on using the changeset viewer.