Changeset 238694 in webkit
- Timestamp:
- Nov 29, 2018 1:58:30 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r238684 r238694 1 2018-11-29 Jonathan Bedard <jbedard@apple.com> 2 3 webkitpy: Unify device creation 4 https://bugs.webkit.org/show_bug.cgi?id=192158 5 <rdar://problem/46344757> 6 7 Reviewed by Lucas Forschler. 8 9 * Scripts/webkitpy/port/device_port.py: 10 (DevicePort): 11 (DevicePort.setup_test_run): Use DEVICE_MANAGER to create devices based on the specified device class. 12 * Scripts/webkitpy/port/ios.py: 13 (IOSPort): Add DEFAULT_DEVICE_CLASS. 14 * Scripts/webkitpy/port/ios_device.py: 15 (IOSDevicePort): 16 (IOSDevicePort._create_devices): Deleted. 17 * Scripts/webkitpy/port/ios_simulator.py: 18 (IOSSimulatorPort._create_devices): Deleted. 19 * Scripts/webkitpy/port/watch.py: 20 (WatchPort): Add DEFAULT_DEVICE_CLASS. 21 * Scripts/webkitpy/port/watch_device.py: 22 (WatchDevicePort): 23 (WatchDevicePort._create_devices): Deleted. 24 * Scripts/webkitpy/port/watch_simulator.py: 25 (WatchSimulatorPort._create_devices): Deleted. 26 * Scripts/webkitpy/xcode/device_type_unittest.py: 27 (DeviceTypeTest.test_from_string): Test that DeviceTypes without hardware types can be constructed 28 from strings. 29 1 30 2018-11-29 Jonathan Bedard <jbedard@apple.com> 2 31 -
trunk/Tools/Scripts/webkitpy/port/device_port.py
r238672 r238694 28 28 from webkitpy.port.darwin import DarwinPort 29 29 from webkitpy.port.simulator_process import SimulatorProcess 30 from webkitpy.xcode.device_type import DeviceType 31 from webkitpy.xcode.simulated_device import DeviceRequest 30 32 31 33 … … 36 38 37 39 DEVICE_MANAGER = None 40 DEFAULT_DEVICE_CLASS = None 41 NO_DEVICE_MANAGER = 'No device manager found for port' 38 42 39 43 def __init__(self, *args, **kwargs): … … 107 111 108 112 def setup_test_run(self, device_class=None): 109 self._create_devices(device_class) 113 if not self.DEVICE_MANAGER: 114 raise RuntimeError(self.NO_DEVICE_MANAGER) 115 116 device_type = DeviceType.from_string(device_class if device_class else self.DEFAULT_DEVICE_CLASS, self.device_version()) 117 _log.debug('\nCreating devices for {}'.format(device_type)) 118 119 request = DeviceRequest( 120 device_type, 121 use_booted_simulator=not self.get_option('dedicated_simulators', False), 122 use_existing_simulator=False, 123 allow_incomplete_match=True, 124 ) 125 self.DEVICE_MANAGER.initialize_devices([request] * self.child_processes(), self.host) 126 127 if not self.devices(): 128 raise RuntimeError('No devices are available for testing') 129 if self.default_child_processes() < self.child_processes(): 130 raise RuntimeError('To few connected devices for {} processes'.format(self.child_processes())) 131 110 132 self._install() 111 133 -
trunk/Tools/Scripts/webkitpy/port/ios.py
r238672 r238694 39 39 40 40 CURRENT_VERSION = Version(12) 41 # FIXME: This is not a clear way to do this (although it works) https://bugs.webkit.org/show_bug.cgi?id=192160 42 DEFAULT_DEVICE_CLASS = '' 41 43 42 44 def __init__(self, host, port_name, **kwargs): -
trunk/Tools/Scripts/webkitpy/port/ios_device.py
r238672 r238694 42 42 43 43 SDK = apple_additions().get_sdk('iphoneos') if apple_additions() else 'iphoneos' 44 NO_ON_DEVICE_TESTING = 'On-device testing is not supported on this machine' 44 NO_ON_DEVICE_TESTING = 'On-device testing is not supported in this configuration' 45 NO_DEVICE_MANAGER = NO_ON_DEVICE_TESTING 45 46 46 47 @memoized … … 113 114 return 'ios-device' 114 115 115 def _create_devices(self, device_class):116 if not apple_additions():117 raise RuntimeError(self.NO_ON_DEVICE_TESTING)118 if not self.devices():119 raise RuntimeError('No devices are available for testing')120 121 if self.default_child_processes() < self.child_processes():122 raise RuntimeError('Not enought connected devices for {} processes'.format(self.child_processes()))123 124 116 def clean_up_test_run(self): 125 117 super(IOSDevicePort, self).clean_up_test_run() -
trunk/Tools/Scripts/webkitpy/port/ios_simulator.py
r238672 r238694 28 28 from webkitpy.port.ios import IOSPort 29 29 from webkitpy.xcode.device_type import DeviceType 30 from webkitpy.xcode.simulated_device import DeviceRequest,SimulatedDeviceManager30 from webkitpy.xcode.simulated_device import SimulatedDeviceManager 31 31 32 32 … … 81 81 def _set_device_class(self, device_class): 82 82 self._device_class = device_class if device_class else self.DEFAULT_DEVICE_CLASS 83 84 def _create_devices(self, device_class):85 self._set_device_class(device_class)86 device_type = DeviceType.from_string(self._device_class, self.device_version())87 88 _log.debug('\nCreating devices for {}'.format(device_type))89 90 request = DeviceRequest(91 device_type,92 use_booted_simulator=not self.get_option('dedicated_simulators', False),93 use_existing_simulator=False,94 allow_incomplete_match=True,95 )96 SimulatedDeviceManager.initialize_devices([request] * self.child_processes(), self.host)97 83 98 84 def clean_up_test_run(self): -
trunk/Tools/Scripts/webkitpy/port/watch.py
r238672 r238694 37 37 38 38 CURRENT_VERSION = Version(5) 39 DEFAULT_DEVICE_CLASS = 'Apple Watch' 39 40 40 41 def __init__(self, *args, **kwargs): -
trunk/Tools/Scripts/webkitpy/port/watch_device.py
r238672 r238694 41 41 DEVICE_MANAGER = apple_additions().device_manager() if apple_additions() else None 42 42 NO_ON_DEVICE_TESTING = 'On-device testing is not supported in this configuration' 43 NO_DEVICE_MANAGER = NO_ON_DEVICE_TESTING 43 44 44 45 @memoized … … 111 112 return 'watchos-device' 112 113 113 def _create_devices(self, device_class):114 if not apple_additions():115 raise RuntimeError(self.NO_ON_DEVICE_TESTING)116 if not apple_additions().device_for_worker_number_map(self, software_variant='watchOS'):117 raise RuntimeError('No devices are available for testing')118 119 if self.default_child_processes() < self.child_processes():120 raise RuntimeError('Not enought connected devices for {} processes'.format(self.child_processes()))121 122 114 def clean_up_test_run(self): 123 115 super(WatchDevicePort, self).clean_up_test_run() -
trunk/Tools/Scripts/webkitpy/port/watch_simulator.py
r238672 r238694 28 28 from webkitpy.port.watch import WatchPort 29 29 from webkitpy.xcode.device_type import DeviceType 30 from webkitpy.xcode.simulated_device import DeviceRequest,SimulatedDeviceManager30 from webkitpy.xcode.simulated_device import SimulatedDeviceManager 31 31 32 32 _log = logging.getLogger(__name__) … … 95 95 self._device_class = device_class or self.DEFAULT_DEVICE_CLASS 96 96 97 def _create_devices(self, device_class):98 self._set_device_class(device_class)99 device_type = DeviceType.from_string(self._device_class, self.device_version())100 101 _log.debug('\nCreating devices for {}'.format(device_type))102 103 request = DeviceRequest(104 device_type,105 use_booted_simulator=not self.get_option('dedicated_simulators', False),106 use_existing_simulator=False,107 allow_incomplete_match=True,108 )109 SimulatedDeviceManager.initialize_devices([request] * self.child_processes(), self.host)110 111 97 def operating_system(self): 112 98 return 'watchos-simulator' -
trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py
r226263 r238694 104 104 self.assertEqual('Apple Watch Series 2 - 42mm running watchOS', str(DeviceType.from_string('Apple Watch Series 2 - 42mm'))) 105 105 self.assertEqual('Apple TV 4K running tvOS', str(DeviceType.from_string('Apple TV 4K'))) 106 self.assertEqual('Device running iOS', str(DeviceType.from_string(''))) 107 self.assertEqual('Apple Watch running watchOS', str(DeviceType.from_string('Apple Watch'))) 106 108 107 109 def test_comparison(self):
Note: See TracChangeset
for help on using the changeset viewer.