Diff
Modified: trunk/Tools/ChangeLog (214398 => 214399)
--- trunk/Tools/ChangeLog 2017-03-25 08:35:07 UTC (rev 214398)
+++ trunk/Tools/ChangeLog 2017-03-25 14:44:26 UTC (rev 214399)
@@ -1,3 +1,41 @@
+2017-03-25 Jonathan Bedard <jbed...@apple.com>
+
+ webkitpy: Use generalized device instead of platform specific one
+ https://bugs.webkit.org/show_bug.cgi?id=170078
+
+ Reviewed by Daniel Bates.
+
+ SimulatedDevice is re-created each time 'xcrun simctl list' is called. Device
+ should remain persistent. Changing Device to a more explicit interface.
+ SimulatedDevice no longer inherits from Device and IOSSimulator returns Devices
+ wrapping SimulatedDevices.
+
+ * Scripts/webkitpy/port/device.py: Added.
+ (Device):
+ (Device.__init__): Construct with platform device.
+ (Device.install_app): Install app at app path on platform device.
+ (Device.launch_app): Launch app with bundle ID on platform device.
+ (Device.poll): Poll platform device.
+ (Device.udid): Access platform device UDID.
+ (Device.__nonzero__): Check if instantiated with a valid platform device.
+ (Device.__eq__): Compare by udid.
+ (Device.__ne__): Ditto.
+ (Device.__repr__): Print out platform_device representation.
+ * Scripts/webkitpy/port/ios_simulator.py:
+ (IOSSimulatorPort.__init__): Initialize the _device_map to an empty dictionary.
+ (IOSSimulatorPort._device_for_worker_number_map): Return self._device_map.
+ (IOSSimulatorPort._create_simulators): Call Simulator.managed_devices directly.
+ (IOSSimulatorPort._create_devices): Place Simulator.managed_devices into the
+ device map.
+ (IOSSimulatorPort._quit_ios_simulator): Reset self._device_map.
+ * Scripts/webkitpy/xcode/device.py: Removed.
+ * Scripts/webkitpy/xcode/simulated_device.py:
+ (SimulatedDevice):
+ (SimulatedDevice.__init__): Move host, name and did to SimulatedDevice.
+ (SimulatedDevice.__eq__): Compare two simulated devices.
+ (SimulatedDevice.__ne__): Ditto.
+ (SimulatedDevice.__repr__): Print name and udid.
+
2017-03-25 Adrian Perez de Castro <ape...@igalia.com>
[GTK] No value returned from PrintCustomWidgetTest::createWebKitPrintOperation() in TestPrinting.cpp
Copied: trunk/Tools/Scripts/webkitpy/port/device.py (from rev 214398, trunk/Tools/Scripts/webkitpy/xcode/device.py) (0 => 214399)
--- trunk/Tools/Scripts/webkitpy/port/device.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/device.py 2017-03-25 14:44:26 UTC (rev 214399)
@@ -0,0 +1,52 @@
+# Copyright (C) 2017 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+class Device(object):
+ def __init__(self, platform_device):
+ self.platform_device = platform_device
+
+ def install_app(self, app_path, env=None):
+ return self.platform_device.install_app(app_path, env)
+
+ def launch_app(self, bundle_id, args, env=None):
+ return self.platform_device.launch_app(bundle_id, args, env)
+
+ # FIXME: This should be implemented through an executive
+ def poll(self, pid):
+ return self.platform_device.poll(pid)
+
+ @property
+ def udid(self):
+ return self.platform_device.udid
+
+ def __nonzero__(self):
+ return self.platform_device is not None
+
+ def __eq__(self, other):
+ return self.udid == other.udid
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return str(self.platform_device)
Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator.py (214398 => 214399)
--- trunk/Tools/Scripts/webkitpy/port/ios_simulator.py 2017-03-25 08:35:07 UTC (rev 214398)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator.py 2017-03-25 14:44:26 UTC (rev 214399)
@@ -30,6 +30,7 @@
from webkitpy.common.memoized import memoized
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
from webkitpy.port import image_diff
+from webkitpy.port.device import Device
from webkitpy.port.ios import IOSPort
from webkitpy.xcode.simulator import Simulator, Runtime, DeviceType
from webkitpy.common.system.crashlogs import CrashLogs
@@ -73,7 +74,8 @@
self._device_class = optional_device_class if optional_device_class else self.DEFAULT_DEVICE_CLASS
_log.debug('IOSSimulatorPort _device_class is %s', self._device_class)
- self._current_device = Simulator(host).current_device()
+ self._device_map = {}
+ self._current_device = Device(Simulator(host).current_device())
if not self._current_device:
self.set_option('dedicated_simulators', True)
if not self.get_option('dedicated_simulators'):
@@ -82,7 +84,7 @@
self.set_option('child_processes', 1)
def _device_for_worker_number_map(self):
- return Simulator.managed_devices
+ return self._device_map
@property
@memoized
@@ -201,13 +203,13 @@
self._create_device(i)
for i in xrange(self.child_processes()):
- device_udid = self._testing_device(i).udid
+ device_udid = Simulator.managed_devices[i].udid
Simulator.wait_until_device_is_in_state(device_udid, Simulator.DeviceState.SHUTDOWN)
Simulator.reset_device(device_udid)
else:
assert(self._current_device)
- if self._current_device.name != self.simulator_device_type().name:
- _log.warn("Expected simulator of type '" + self.simulator_device_type().name + "' but found simulator of type '" + self._current_device.name + "'")
+ if self._current_device.platform_device.name != self.simulator_device_type().name:
+ _log.warn("Expected simulator of type '" + self.simulator_device_type().name + "' but found simulator of type '" + self._current_device.platform_device.name + "'")
_log.warn('The next block of tests may fail due to device mis-match')
def _create_devices(self, device_class):
@@ -224,7 +226,7 @@
return
for i in xrange(self.child_processes()):
- device_udid = self._testing_device(i).udid
+ device_udid = Simulator.managed_devices[i].udid
_log.debug('testing device %s has udid %s', i, device_udid)
# FIXME: <rdar://problem/20916140> Switch to using CoreSimulator.framework for launching and quitting iOS Simulator
@@ -237,9 +239,14 @@
_log.info('Waiting for all iOS Simulators to finish booting.')
for i in xrange(self.child_processes()):
- Simulator.wait_until_device_is_booted(self._testing_device(i).udid)
+ Simulator.wait_until_device_is_booted(Simulator.managed_devices[i].udid)
+ self._device_map = {}
+ for id, platform_device in Simulator.managed_devices:
+ self._device_map[id] = Device(platform_device)
+
def _quit_ios_simulator(self):
+ self._device_map = {}
if not self._using_dedicated_simulators():
return
_log.debug("_quit_ios_simulator killing all Simulator processes")
Deleted: trunk/Tools/Scripts/webkitpy/xcode/device.py (214398 => 214399)
--- trunk/Tools/Scripts/webkitpy/xcode/device.py 2017-03-25 08:35:07 UTC (rev 214398)
+++ trunk/Tools/Scripts/webkitpy/xcode/device.py 2017-03-25 14:44:26 UTC (rev 214399)
@@ -1,48 +0,0 @@
-# Copyright (C) 2017 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-class Device(object):
- def __init__(self, name, udid, host):
- self._host = host
- self.name = name
- self.udid = udid
-
- def install_app(self, app_path, env=None):
- raise NotImplementedError
-
- def launch_app(self, bundle_id, args, env=None):
- raise NotImplementedError
-
- def poll(self, pid):
- raise NotImplementedError
-
- def __eq__(self, other):
- return self.udid == other.udid
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __repr__(self):
- return 'Device "{name}": {udid}.'.format(
- name=self.name,
- udid=self.udid)
Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (214398 => 214399)
--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2017-03-25 08:35:07 UTC (rev 214398)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2017-03-25 14:44:26 UTC (rev 214399)
@@ -27,7 +27,6 @@
import signal
import subprocess
-from webkitpy.xcode.device import Device
from webkitpy.xcode.simulator import Simulator
from webkitpy.common.host import Host
@@ -34,7 +33,7 @@
_log = logging.getLogger(__name__)
-class SimulatedDevice(Device):
+class SimulatedDevice(object):
"""
Represents a CoreSimulator device underneath a runtime
"""
@@ -52,9 +51,11 @@
:param host: The host which can run command line commands
:type host: Host
"""
- super(SimulatedDevice, self).__init__(name, udid, host)
self.available = available
self.runtime = runtime
+ self._host = host
+ self.name = name
+ self.udid = udid
@property
def state(self):
@@ -196,9 +197,16 @@
return 1
return None
+ def __eq__(self, other):
+ return self.udid == other.udid
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def __repr__(self):
- return '<{device_info} State: {state}. Runtime: {runtime}, Available: {available}>'.format(
- device_info=super(SimulatedDevice, self).__repr__(),
+ return '<Device "{name}": {udid}. State: {state}. Runtime: {runtime}, Available: {available}>'.format(
+ name=self.name,
+ udid=self.udid,
state=self.state,
available=self.available,
runtime=self.runtime.identifier)