Title: [238944] trunk/Tools
Revision
238944
Author
[email protected]
Date
2018-12-06 15:21:33 -0800 (Thu, 06 Dec 2018)

Log Message

REGRESSION: run-webkit-tests may fail when using booted simulators
https://bugs.webkit.org/show_bug.cgi?id=192470
<rdar://problem/46532001>

Reviewed by Lucas Forschler.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.run): Logging uses the number of child processes to print out information about how efficiently tests
were sharded after the fact. This number is the most meaningful if it is the maximum number of child processes used.
* Scripts/webkitpy/port/base.py:
(Port.max_child_processes): By default, Ports do not support running on any specific kind of device.
* Scripts/webkitpy/port/device_port.py:
(DevicePort.default_child_processes): Rather than using the currently initialized devices as a proxy for how many
child processes are being used, check the device manager every time. Regardless of which devices are attached or
available, iOS cannot boot watchOS devices and vice-versa. dedicated_simulators is not a known argument to
device_count_for_type, use use_booted_simulator instead.
(DevicePort.max_child_processes): Simulators can boot more devices than what is specified by device_count_for_type,
but, if no devices are available, then max_child_processes should return 0 even for simulators.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest):
(IOSDeviceTest.test_max_child_processes):
* Scripts/webkitpy/port/ios_simulator_unittest.py:
(IOSSimulatorTest):
(IOSSimulatorTest.test_max_child_processes):
* Scripts/webkitpy/port/port_testcase.py:
(PortTestCase):
(PortTestCase.test_max_child_processes):
* Scripts/webkitpy/port/watch_simulator_unittest.py:
(WatchSimulatorTest):
(WatchSimulatorTest.test_max_child_processes):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (238943 => 238944)


--- trunk/Tools/ChangeLog	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/ChangeLog	2018-12-06 23:21:33 UTC (rev 238944)
@@ -1,5 +1,38 @@
 2018-12-06  Jonathan Bedard  <[email protected]>
 
+        REGRESSION: run-webkit-tests may fail when using booted simulators
+        https://bugs.webkit.org/show_bug.cgi?id=192470
+        <rdar://problem/46532001>
+
+        Reviewed by Lucas Forschler.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.run): Logging uses the number of child processes to print out information about how efficiently tests
+        were sharded after the fact. This number is the most meaningful if it is the maximum number of child processes used.
+        * Scripts/webkitpy/port/base.py:
+        (Port.max_child_processes): By default, Ports do not support running on any specific kind of device.
+        * Scripts/webkitpy/port/device_port.py:
+        (DevicePort.default_child_processes): Rather than using the currently initialized devices as a proxy for how many
+        child processes are being used, check the device manager every time. Regardless of which devices are attached or
+        available, iOS cannot boot watchOS devices and vice-versa. dedicated_simulators is not a known argument to
+        device_count_for_type, use use_booted_simulator instead.
+        (DevicePort.max_child_processes): Simulators can boot more devices than what is specified by device_count_for_type,
+        but, if no devices are available, then max_child_processes should return 0 even for simulators.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest):
+        (IOSDeviceTest.test_max_child_processes):
+        * Scripts/webkitpy/port/ios_simulator_unittest.py:
+        (IOSSimulatorTest):
+        (IOSSimulatorTest.test_max_child_processes):
+        * Scripts/webkitpy/port/port_testcase.py:
+        (PortTestCase):
+        (PortTestCase.test_max_child_processes):
+        * Scripts/webkitpy/port/watch_simulator_unittest.py:
+        (WatchSimulatorTest):
+        (WatchSimulatorTest.test_max_child_processes):
+
+2018-12-06  Jonathan Bedard  <[email protected]>
+
         webkitpy: Ignore case when comparing device types (Follow-up fix)
         https://bugs.webkit.org/show_bug.cgi?id=192409
         <rdar://problem/46491558>

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -245,6 +245,7 @@
         retry_results = None
         enabled_pixel_tests_in_retry = False
 
+        max_child_processes_for_run = 1
         child_processes_option_value = self._options.child_processes
 
         while device_type_order:
@@ -260,6 +261,8 @@
                 _log.info('')
                 continue
 
+            max_child_processes_for_run = max(self._options.child_processes, max_child_processes_for_run)
+
             # This loop looks for any less-specific device types which match the current device type
             index = 0
             while index < len(device_type_order):
@@ -281,6 +284,9 @@
             retry_results = retry_results.merge(temp_retry_results) if retry_results else temp_retry_results
             enabled_pixel_tests_in_retry |= temp_enabled_pixel_tests_in_retry
 
+        # Used for final logging, max_child_processes_for_run is most relevant here.
+        self._options.child_processes = max_child_processes_for_run
+
         self._runner.stop_servers()
 
         end_time = time.time()

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -181,8 +181,10 @@
         """Return the number of DumpRenderTree instances to use for this port."""
         return self._executive.cpu_count()
 
-    def max_child_processes(self, **kwargs):
+    def max_child_processes(self, device_type=None):
         """Forbid the user from specifying more than this number of child processes"""
+        if device_type:
+            return 0
         return float('inf')
 
     def worker_startup_delay_secs(self):

Modified: trunk/Tools/Scripts/webkitpy/port/device_port.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/device_port.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/device_port.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -115,18 +115,25 @@
     def default_child_processes(self, device_type=None):
         if not self.DEVICE_MANAGER:
             raise RuntimeError(self.NO_DEVICE_MANAGER)
-        if self.DEVICE_MANAGER.INITIALIZED_DEVICES:
-            return len(self.DEVICE_MANAGER.INITIALIZED_DEVICES)
+
+        # FIXME Checking software variant is important for simulators, otherwise an iOS port could boot a watchOS simulator.
+        # Really, the DEFAULT_DEVICE_TYPE for simulators should be a general instead of specific type, then this code would
+        # explicitly compare against device_type
+        device_type = self._device_type_with_version(device_type)
+        if device_type.software_variant and self.DEFAULT_DEVICE_TYPE.software_variant != device_type.software_variant:
+            return 0
+
         return self.DEVICE_MANAGER.device_count_for_type(
             self._device_type_with_version(device_type),
             host=self.host,
-            dedicated_simulators=not self.get_option('dedicated_simulators', False),
+            use_booted_simulator=not self.get_option('dedicated_simulators', False),
         )
 
     def max_child_processes(self, device_type=None):
-        if self.DEVICE_MANAGER == SimulatedDeviceManager:
-            return super(DevicePort, self).max_child_processes(device_type=device_type)
-        return self.default_child_processes(device_type=device_type)
+        result = self.default_child_processes(device_type=device_type)
+        if result and self.DEVICE_MANAGER == SimulatedDeviceManager:
+            return super(DevicePort, self).max_child_processes(device_type=None)
+        return result
 
     def setup_test_run(self, device_type=None):
         if not self.DEVICE_MANAGER:

Modified: trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -112,3 +112,6 @@
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-wk2')
         self.assertEqual(search_path[6], '/mock-checkout/LayoutTests/platform/ios')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/wk2')
+
+    def test_max_child_processes(self):
+        pass

Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -27,6 +27,7 @@
 from webkitpy.common.version import Version
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
+from webkitpy.xcode.device_type import DeviceType
 
 
 class IOSSimulatorTest(ios_testcase.IOSTest):
@@ -115,3 +116,7 @@
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-wk2')
         self.assertEqual(search_path[6], '/mock-checkout/LayoutTests/platform/ios')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/wk2')
+
+    def test_max_child_processes(self):
+        port = self.make_port()
+        self.assertEqual(port.max_child_processes(DeviceType.from_string('Apple Watch')), 0)

Modified: trunk/Tools/Scripts/webkitpy/port/port_testcase.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/port_testcase.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/port_testcase.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -684,3 +684,8 @@
     def test_additional_platform_directory(self):
         port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo']))
         self.assertEqual(port.baseline_search_path()[0], '/tmp/foo')
+
+    def test_max_child_processes(self):
+        port = self.make_port()
+        self.assertEqual(port.max_child_processes(True), 0)
+        self.assertEqual(port.max_child_processes(), float('inf'))

Modified: trunk/Tools/Scripts/webkitpy/port/watch_simulator_unittest.py (238943 => 238944)


--- trunk/Tools/Scripts/webkitpy/port/watch_simulator_unittest.py	2018-12-06 23:05:36 UTC (rev 238943)
+++ trunk/Tools/Scripts/webkitpy/port/watch_simulator_unittest.py	2018-12-06 23:21:33 UTC (rev 238944)
@@ -26,6 +26,7 @@
 from webkitpy.port.watch_simulator import WatchSimulatorPort
 from webkitpy.port import watch_testcase
 from webkitpy.tool.mocktool import MockOptions
+from webkitpy.xcode.device_type import DeviceType
 
 
 class WatchSimulatorTest(watch_testcase.WatchTest):
@@ -74,3 +75,7 @@
         port._executive = MockExecutive2(run_command_fn=throwing_run_command)
         expected_stdout = "['xcrun', '--sdk', 'watchsimulator', '-find', 'test']\n"
         OutputCapture().assert_outputs(self, port.xcrun_find, args=['test', 'falling'], expected_stdout=expected_stdout)
+
+    def test_max_child_processes(self):
+        port = self.make_port()
+        self.assertEqual(port.max_child_processes(DeviceType.from_string('iPhone')), 0)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to