Changeset 238749 in webkit
- Timestamp:
- Nov 30, 2018 12:13:16 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r238742 r238749 1 2018-11-30 Jonathan Bedard <jbedard@apple.com> 2 3 webkitpy: Use DeviceType instead of str to represent device class 4 https://bugs.webkit.org/show_bug.cgi?id=192160 5 <rdar://problem/46344845> 6 7 Rubber-stamped by Aakash Jain. 8 9 * Scripts/webkitpy/layout_tests/controllers/manager.py: 10 (Manager._custom_device_for_test): Use DeviceTypes instead of strings to represent device type. 11 (Manager._set_up_run): Do not set _options.device_class, use device_type instead of device_class. 12 (Manager.run): Use device_type instead of device_class. 13 (Manager._print_expectations_for_subset): Ditto. 14 (Manager.print_expectations): Ditto. 15 * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py: 16 (ManagerTest.test_uses_custom_device): Use DeviceType and actual device definition. 17 * Scripts/webkitpy/layout_tests/views/printing.py: 18 (Printer.print_workers_and_shards): Outputting the device suffix doesn't really help, and means 19 device type needs to be passed around. 20 * Scripts/webkitpy/port/apple.py: 21 (ApplePort.setup_test_run): Use device_type instead of device_class. 22 * Scripts/webkitpy/port/base.py: 23 (Port): 24 (Port.setup_test_run): Use device_type instead of device_class. 25 * Scripts/webkitpy/port/device_port.py: 26 (DevicePort): 27 (DevicePort.setup_test_run): Receive device_type as DeviceType object. 28 (DevicePort._create_devices): Deleted. 29 * Scripts/webkitpy/port/gtk.py: 30 (GtkPort.setup_test_run): Use device_type instead of device_class. 31 * Scripts/webkitpy/port/ios.py: 32 (IOSPort): 33 * Scripts/webkitpy/port/ios_simulator.py: 34 (IOSSimulatorPort): 35 (IOSSimulatorPort.__init__): Deleted. 36 (IOSSimulatorPort._set_device_class): Deleted. 37 * Scripts/webkitpy/port/test.py: 38 * Scripts/webkitpy/port/watch.py: 39 (WatchPort): 40 * Scripts/webkitpy/port/watch_simulator.py: 41 (WatchSimulatorPort): 42 (WatchSimulatorPort.__init__): Deleted. 43 (WatchSimulatorPort._set_device_class): Deleted. 44 * Scripts/webkitpy/port/win.py: 45 (WinPort.setup_test_run): Use device_type instead of device_class. 46 * Scripts/webkitpy/xcode/simulated_device.py: 47 (SimulatedDeviceManager._disambiguate_device_type): Using the existing devices for this is 48 a problem if no such device exists yet. Use the _device_identifier_to_name dictionary instead 49 since this should have hardware types in the device names. 50 1 51 2018-11-30 David Quesada <david_quesada@apple.com> 2 52 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
r237914 r238749 56 56 from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS 57 57 from webkitpy.tool.grammar import pluralize 58 from webkitpy.xcode.device_type import DeviceType 58 59 59 60 _log = logging.getLogger(__name__) … … 104 105 105 106 def _custom_device_for_test(self, test): 106 for device_class in self._port.CUSTOM_DEVICE_CLASSES: 107 directory_suffix = device_class.lower().replace(' ', '') + self._port.TEST_PATH_SEPARATOR 108 if directory_suffix in test: 109 return device_class 107 # FIXME: Use available devices instead of CUSTOM_DEVICE_TYPES https://bugs.webkit.org/show_bug.cgi?id=192161 108 # FIXME: This is a terrible way to do device-specific expected results https://bugs.webkit.org/show_bug.cgi?id=192162 109 for device_type in self._port.CUSTOM_DEVICE_TYPES: 110 if device_type.hardware_family and device_type.hardware_family.lower() + self._port.TEST_PATH_SEPARATOR in test: 111 return device_type 112 if device_type.hardware_family and device_type.hardware_type and \ 113 (device_type.hardware_family + device_type.hardware_type).lower().replace(' ', '') + self._port.TEST_PATH_SEPARATOR in test: 114 return device_type 110 115 return None 111 116 … … 160 165 self._options.child_processes = worker_count 161 166 162 def _set_up_run(self, test_names, device_class=None): 163 self._options.device_class = device_class 164 167 def _set_up_run(self, test_names, device_type=None): 165 168 # This must be started before we check the system dependencies, 166 169 # since the helper may do things to make the setup correct. … … 179 182 return False 180 183 181 self._port.setup_test_run( self._options.device_class)184 self._port.setup_test_run(device_type) 182 185 return True 183 186 … … 216 219 217 220 if custom_device_tests: 218 for device_ class in custom_device_tests:219 _log.debug('{} tests use device {}'.format(len( custom_device_tests[device_class]), device_class))221 for device_type, tests in custom_device_tests.iteritems(): 222 _log.debug('{} tests use device {}'.format(len(tests), device_type)) 220 223 221 224 initial_results = None … … 251 254 # Only use a single worker for custom device classes 252 255 self._options.child_processes = 1 253 for device_ classin custom_device_tests:254 device_tests = custom_device_tests[device_ class]256 for device_type in custom_device_tests: 257 device_tests = custom_device_tests[device_type] 255 258 if device_tests: 256 259 _log.info('') 257 _log.info('Running %s for %s', pluralize(len(device_tests), "test"), device_ class)260 _log.info('Running %s for %s', pluralize(len(device_tests), "test"), device_type) 258 261 _log.info('') 259 if not self._set_up_run(device_tests, device_ class):262 if not self._set_up_run(device_tests, device_type): 260 263 return test_run_results.RunDetails(exit_code=-1) 261 264 … … 545 548 print(format_string.format(test, line.expected_behavior, self._expectations.readable_filename_and_line_number(line), line.original_string or '')) 546 549 547 def _print_expectations_for_subset(self, device_ class, test_col_width, tests_to_run, tests_to_skip={}):550 def _print_expectations_for_subset(self, device_type, test_col_width, tests_to_run, tests_to_skip={}): 548 551 format_string = '{{:{width}}} {{}} {{}} {{}}'.format(width=test_col_width) 549 552 if tests_to_skip: … … 554 557 555 558 print('') 556 print('Tests to run{} ({})'.format(' for ' + device_class if device_classelse '', len(tests_to_run)))559 print('Tests to run{} ({})'.format(' for ' + str(device_type) if device_type else '', len(tests_to_run))) 557 560 for test in sorted(tests_to_run): 558 561 self._print_expectation_line_for_test(format_string, test) … … 587 590 588 591 if custom_device_tests: 589 for device_ class in custom_device_tests:590 _log.debug('{} tests use device {}'.format(len( custom_device_tests[device_class]), device_class))592 for device_type, tests in custom_device_tests.iteritems(): 593 _log.debug('{} tests use device {}'.format(len(tests), device_type)) 591 594 592 595 self._print_expectations_for_subset(None, test_col_width, tests_to_run, tests_to_skip) 593 596 594 for device_class in custom_device_tests: 595 device_tests = custom_device_tests[device_class] 596 self._print_expectations_for_subset(device_class, test_col_width, device_tests) 597 for device_type, tests in custom_device_tests.iteritems(): 598 self._print_expectations_for_subset(device_type, test_col_width, tests) 597 599 598 600 return 0 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
r216725 r238749 41 41 from webkitpy.thirdparty.mock import Mock 42 42 from webkitpy.tool.mocktool import MockOptions 43 from webkitpy.xcode.device_type import DeviceType 43 44 44 45 … … 108 109 def test_uses_custom_device(self): 109 110 class MockCustomDevicePort(TestPort): 110 CUSTOM_DEVICE_ CLASSES = ['starship']111 CUSTOM_DEVICE_TYPES = [DeviceType(hardware_family='iPad')] 111 112 112 113 def __init__(self, host): … … 116 117 host = MockHost() 117 118 port = MockCustomDevicePort(host) 118 manager = Manager(port, options=MockOptions(test_list=['fast/ test-starship/lasers.html'], http=True), printer=Mock())119 manager = Manager(port, options=MockOptions(test_list=['fast/ipad/lasers.html'], http=True), printer=Mock()) 119 120 return manager 120 121 121 122 manager = get_manager() 122 self.assertTrue(manager._custom_device_for_test('fast/ test-starship/lasers.html') == 'starship')123 self.assertTrue(manager._custom_device_for_test('fast/ipad/lasers.html') == DeviceType(hardware_family='iPad')) -
trunk/Tools/Scripts/webkitpy/layout_tests/views/printing.py
r235771 r238749 114 114 driver_name = self._port.driver_name() 115 115 116 device_suffix = ' for device "{}"'.format(self._options.device_class) if self._options.device_class else ''117 116 if num_workers == 1: 118 self._print_default('Running 1 {} {}.'.format(driver_name, device_suffix))117 self._print_default('Running 1 {}.'.format(driver_name)) 119 118 self._print_debug('({}).'.format(grammar.pluralize(num_shards, "shard"))) 120 119 else: 121 self._print_default('Running {} in parallel {}.'.format(grammar.pluralize(num_workers, driver_name), device_suffix))120 self._print_default('Running {} in parallel.'.format(grammar.pluralize(num_workers, driver_name))) 122 121 self._print_debug('({} shards).'.format(num_shards)) 123 122 self._print_default('') -
trunk/Tools/Scripts/webkitpy/port/apple.py
r229955 r238749 85 85 self._version = self._strip_port_name_prefix(port_name) 86 86 87 def setup_test_run(self, device_ class=None):87 def setup_test_run(self, device_type=None): 88 88 self._crash_logs_to_skip_for_host[self.host] = self.host.filesystem.files_under(self.path_to_crash_logs()) 89 89 -
trunk/Tools/Scripts/webkitpy/port/base.py
r235227 r238749 82 82 DEFAULT_ARCHITECTURE = 'x86' 83 83 84 CUSTOM_DEVICE_ CLASSES = []84 CUSTOM_DEVICE_TYPES = [] 85 85 86 86 @classmethod … … 880 880 return self._build_path('web-platform-tests-manifest.json') 881 881 882 def setup_test_run(self, device_ class=None):882 def setup_test_run(self, device_type=None): 883 883 """Perform port-specific work at the beginning of a test run.""" 884 884 pass -
trunk/Tools/Scripts/webkitpy/port/device_port.py
r238694 r238749 38 38 39 39 DEVICE_MANAGER = None 40 DEFAULT_DEVICE_ CLASS= None40 DEFAULT_DEVICE_TYPE = None 41 41 NO_DEVICE_MANAGER = 'No device manager found for port' 42 42 … … 88 88 return self.DEVICE_MANAGER.INITIALIZED_DEVICES 89 89 90 def _create_devices(self, device_class):91 raise NotImplementedError92 93 90 # Despite their names, these flags do not actually get passed all the way down to webkit-build. 94 91 def _build_driver_flags(self): … … 110 107 raise RuntimeError('Failed to install dylibs at {} on device {}'.format(self._build_path(), device.udid)) 111 108 112 def setup_test_run(self, device_ class=None):109 def setup_test_run(self, device_type=None): 113 110 if not self.DEVICE_MANAGER: 114 111 raise RuntimeError(self.NO_DEVICE_MANAGER) 115 112 116 device_type = DeviceType.from_string(device_class if device_class else self.DEFAULT_DEVICE_CLASS, self.device_version()) 113 device_type = device_type if device_type else self.DEFAULT_DEVICE_TYPE 114 device_type = DeviceType( 115 hardware_family=device_type.hardware_family, 116 hardware_type=device_type.hardware_type, 117 software_version=self.device_version(), 118 software_variant=device_type.software_variant, 119 ) 117 120 _log.debug('\nCreating devices for {}'.format(device_type)) 118 121 -
trunk/Tools/Scripts/webkitpy/port/gtk.py
r237741 r238749 104 104 return super(GtkPort, self).driver_stop_timeout() 105 105 106 def setup_test_run(self, device_ class=None):107 super(GtkPort, self).setup_test_run(device_ class)106 def setup_test_run(self, device_type=None): 107 super(GtkPort, self).setup_test_run(device_type) 108 108 self._pulseaudio_sanitizer.unload_pulseaudio_module() 109 109 -
trunk/Tools/Scripts/webkitpy/port/ios.py
r238694 r238749 31 31 from webkitpy.port.device_port import DevicePort 32 32 from webkitpy.port.simulator_process import SimulatorProcess 33 from webkitpy.xcode.device_type import DeviceType 33 34 34 35 _log = logging.getLogger(__name__) … … 40 41 CURRENT_VERSION = Version(12) 41 42 # 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 = ''43 DEFAULT_DEVICE_TYPE = DeviceType(software_variant='iOS') 43 44 44 45 def __init__(self, host, port_name, **kwargs): -
trunk/Tools/Scripts/webkitpy/port/ios_simulator.py
r238694 r238749 43 43 DEVICE_MANAGER = SimulatedDeviceManager 44 44 45 DEFAULT_DEVICE_ CLASS = 'iPhone SE'46 CUSTOM_DEVICE_ CLASSES = ['iPad', 'iPhone 7']45 DEFAULT_DEVICE_TYPE = DeviceType(hardware_family='iPhone', hardware_type='SE') 46 CUSTOM_DEVICE_TYPES = [DeviceType(hardware_family='iPad'), DeviceType(hardware_family='iPhone', hardware_type='7')] 47 47 SDK = apple_additions().get_sdk('iphonesimulator') if apple_additions() else 'iphonesimulator' 48 49 def __init__(self, host, port_name, **kwargs):50 super(IOSSimulatorPort, self).__init__(host, port_name, **kwargs)51 52 optional_device_class = self.get_option('device_class')53 self._device_class = optional_device_class if optional_device_class else self.DEFAULT_DEVICE_CLASS54 _log.debug('IOSSimulatorPort _device_class is %s', self._device_class)55 48 56 49 @staticmethod … … 78 71 return num_booted_sims 79 72 return SimulatedDeviceManager.max_supported_simulators(self.host) 80 81 def _set_device_class(self, device_class):82 self._device_class = device_class if device_class else self.DEFAULT_DEVICE_CLASS83 73 84 74 def clean_up_test_run(self): -
trunk/Tools/Scripts/webkitpy/port/test.py
r235764 r238749 468 468 return '/tmp/layout-test-results' 469 469 470 def setup_test_run(self, device_ class=None):470 def setup_test_run(self, device_type=None): 471 471 pass 472 472 -
trunk/Tools/Scripts/webkitpy/port/watch.py
r238694 r238749 28 28 from webkitpy.port.config import apple_additions 29 29 from webkitpy.port.device_port import DevicePort 30 from webkitpy.xcode.device_type import DeviceType 30 31 31 32 … … 37 38 38 39 CURRENT_VERSION = Version(5) 39 DEFAULT_DEVICE_ CLASS = 'Apple Watch'40 DEFAULT_DEVICE_TYPE = DeviceType(software_variant='watchOS') 40 41 41 42 def __init__(self, *args, **kwargs): -
trunk/Tools/Scripts/webkitpy/port/watch_simulator.py
r238694 r238749 41 41 DEVICE_MANAGER = SimulatedDeviceManager 42 42 43 DEFAULT_DEVICE_CLASS = 'Apple Watch Series 3 - 42mm' 44 CUSTOM_DEVICE_CLASSES = [] 43 DEFAULT_DEVICE_TYPE = DeviceType(hardware_family='Apple Watch', hardware_type='Series 3 - 42mm') 45 44 SDK = apple_additions().get_sdk('watchsimulator') if apple_additions() else 'watchsimulator' 46 47 def __init__(self, *args, **kwargs):48 super(WatchSimulatorPort, self).__init__(*args, **kwargs)49 50 self._set_device_class(self.get_option('device_class'))51 _log.debug('WatchSimulatorPort _device_class is %s', self._device_class)52 45 53 46 def architecture(self): … … 92 85 return SimulatedDeviceManager.max_supported_simulators(self.host) 93 86 94 def _set_device_class(self, device_class):95 self._device_class = device_class or self.DEFAULT_DEVICE_CLASS96 97 87 def operating_system(self): 98 88 return 'watchos-simulator' -
trunk/Tools/Scripts/webkitpy/port/win.py
r235227 r238749 396 396 _log.warn("Failed to delete preference files.") 397 397 398 def setup_test_run(self, device_ class=None):398 def setup_test_run(self, device_type=None): 399 399 atexit.register(self.restore_crash_log_saving) 400 400 self.setup_crash_log_saving() … … 402 402 self.delete_sem_locks() 403 403 self.delete_preference_files() 404 super(WinPort, self).setup_test_run(device_ class)404 super(WinPort, self).setup_test_run(device_type) 405 405 406 406 def clean_up_test_run(self): -
trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py
r238684 r238749 218 218 if full_device_type.hardware_type is None: 219 219 # Again, we use the existing devices to determine a legal hardware type 220 for device in SimulatedDeviceManager.AVAILABLE_DEVICES: 221 if device.platform_device.device_type == full_device_type: 222 full_device_type.hardware_type = device.platform_device.device_type.hardware_type 220 for name in SimulatedDeviceManager._device_identifier_to_name.itervalues(): 221 type_from_name = DeviceType.from_string(name) 222 if type_from_name == full_device_type: 223 full_device_type.hardware_type = type_from_name.hardware_type 223 224 break 224 225
Note: See TracChangeset
for help on using the changeset viewer.