Title: [240163] trunk/Tools
Revision
240163
Author
jbed...@apple.com
Date
2019-01-18 12:12:38 -0800 (Fri, 18 Jan 2019)

Log Message

webkitpy: Add iPhone and iPad ports
https://bugs.webkit.org/show_bug.cgi?id=193537
<rdar://problem/47353390>

Reviewed by Lucas Forschler.

Add --iphone-simulator and --ipad-simulator commands to run-webkit-tests which separate iPhone and iPad into separate
ports. Note that this separation is optional, the --ios-simulator command remains.

* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(RunTest.test_device_type_test_division): Drive-by fix.
(RunTest.test_device_type_specific_listing): Ditto.
(RunTest.test_ipad_test_division):
(RunTest):
(RunTest.test_ipad_listing):
* Scripts/webkitpy/port/factory.py:
(platform_options): Add --iphone-simulator and --ipad-simulator flags.
(PortFactory):
* Scripts/webkitpy/port/ios_simulator.py:
(IPhoneSimulatorPort):
(IPadSimulatorPort):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (240162 => 240163)


--- trunk/Tools/ChangeLog	2019-01-18 20:07:44 UTC (rev 240162)
+++ trunk/Tools/ChangeLog	2019-01-18 20:12:38 UTC (rev 240163)
@@ -1,3 +1,27 @@
+2019-01-18  Jonathan Bedard  <jbed...@apple.com>
+
+        webkitpy: Add iPhone and iPad ports
+        https://bugs.webkit.org/show_bug.cgi?id=193537
+        <rdar://problem/47353390>
+
+        Reviewed by Lucas Forschler.
+
+        Add --iphone-simulator and --ipad-simulator commands to run-webkit-tests which separate iPhone and iPad into separate
+        ports. Note that this separation is optional, the --ios-simulator command remains.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (RunTest.test_device_type_test_division): Drive-by fix.
+        (RunTest.test_device_type_specific_listing): Ditto.
+        (RunTest.test_ipad_test_division):
+        (RunTest):
+        (RunTest.test_ipad_listing):
+        * Scripts/webkitpy/port/factory.py:
+        (platform_options): Add --iphone-simulator and --ipad-simulator flags.
+        (PortFactory):
+        * Scripts/webkitpy/port/ios_simulator.py:
+        (IPhoneSimulatorPort):
+        (IPadSimulatorPort):
+
 2019-01-18  Chris Dumez  <cdu...@apple.com>
 
         Regression(PSON) Scroll position is not always restored properly when navigating back

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (240162 => 240163)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2019-01-18 20:07:44 UTC (rev 240162)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2019-01-18 20:12:38 UTC (rev 240163)
@@ -28,18 +28,8 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import codecs
 import json
-import logging
-import os
-import platform
-import Queue
-import re
 import StringIO
-import sys
-import thread
-import time
-import threading
 import unittest
 
 from webkitpy.common.system import outputcapture, path
@@ -48,12 +38,9 @@
 from webkitpy.common.host import Host
 from webkitpy.common.host_mock import MockHost
 
-from webkitpy import port
 from webkitpy.layout_tests import run_webkit_tests
 from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
-from webkitpy.port import Port
 from webkitpy.port import test
-from webkitpy.test.skip import skip_if
 from webkitpy.xcode.device_type import DeviceType
 
 
@@ -857,7 +844,7 @@
         for line in logging.getvalue():
             if str(DeviceType.from_string('iPhone SE')) in line:
                 self.assertTrue('Skipping 2 tests' in line)
-            elif str(DeviceType.from_string('iPhone (5th generation)')) in line:
+            elif str(DeviceType.from_string('iPad (5th generation)')) in line:
                 self.assertTrue('Skipping 1 test' in line)
             elif str(DeviceType.from_string('iPhone 7')) in line:
                 self.assertTrue('Skipping 0 tests' in line)
@@ -881,7 +868,7 @@
         current_type = None
         by_type = {}
         for line in output.splitlines():
-            if not line:
+            if not line or 'skip' in line:
                 continue
             if 'Tests to run' in line:
                 current_type = DeviceType.from_string(line.split('for ')[-1].split(' running')[0]) if 'for ' in line else None
@@ -894,7 +881,60 @@
         self.assertEqual(1, len(by_type[DeviceType.from_string('iPad (5th generation)')]))
         self.assertEqual(0, len(by_type[DeviceType.from_string('iPhone 7')]))
 
+    def test_ipad_test_division(self):
+        host = MockHost()
+        port = host.port_factory.get('ipad-simulator')
 
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/test1.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ios/test2.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ipad/test3.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/iphone/test4.html', '')
+        host.filesystem.write_text_file('/MOCK output of child process/ImageDiff', '')
+
+        oc = outputcapture.OutputCapture()
+        try:
+            oc.capture_output()
+            logging = StringIO.StringIO()
+            run_webkit_tests.run(port, run_webkit_tests.parse_args(['--debug-rwt-logging', '-n', '--no-build', '--root', '/build'])[0], [], logging_stream=logging)
+        finally:
+            output, err, _ = oc.restore_output()
+
+        for line in logging.getvalue():
+            if str(DeviceType.from_string('iPad (5th generation)')) in line:
+                self.assertTrue('Skipping 3 test' in line)
+
+    def test_ipad_listing(self):
+        host = MockHost()
+        port = host.port_factory.get('ipad-simulator')
+
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/test1.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ios/test2.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ipad/test3.html', '')
+        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/iphone/test4.html', '')
+
+        oc = outputcapture.OutputCapture()
+        try:
+            oc.capture_output()
+            logging = StringIO.StringIO()
+            run_webkit_tests._print_expectations(port, run_webkit_tests.parse_args([])[0], [], logging_stream=logging)
+        finally:
+            output, _, _ = oc.restore_output()
+
+        current_type = None
+        by_type = {}
+        for line in output.splitlines():
+            if not line or 'skip' in line:
+                continue
+            if 'Tests to run' in line:
+                current_type = DeviceType.from_string(line.split('for ')[-1].split(' running')[0]) if 'for ' in line else None
+                by_type[current_type] = []
+                continue
+            by_type[current_type].append(line)
+
+        self.assertEqual(1, len(by_type.keys()))
+        self.assertEqual(3, len(by_type[DeviceType.from_string('iPad (5th generation)')]))
+
+
 class EndToEndTest(unittest.TestCase):
     def test_reftest_with_two_notrefs(self):
         # Test that we update expectations in place. If the expectation

Modified: trunk/Tools/Scripts/webkitpy/port/factory.py (240162 => 240163)


--- trunk/Tools/Scripts/webkitpy/port/factory.py	2019-01-18 20:07:44 UTC (rev 240162)
+++ trunk/Tools/Scripts/webkitpy/port/factory.py	2019-01-18 20:12:38 UTC (rev 240163)
@@ -47,6 +47,12 @@
         optparse.make_option('--ios-simulator', action='', dest='platform',
             const=('ios-simulator'),
             help=('Alias for --platform=ios-simulator')),
+        optparse.make_option('--iphone-simulator', action='', dest='platform',
+            const=('iphone-simulator'),
+            help=('Alias for --platform=iphone-simulator')),
+        optparse.make_option('--ipad-simulator', action='', dest='platform',
+            const=('ipad-simulator'),
+            help=('Alias for --platform=ipad-simulator')),
         optparse.make_option('--simulator', action='', dest='platform',
             const=('ios-simulator'),
             help=('DEPRECATED alias for --platform=ios-simulator')),
@@ -90,6 +96,8 @@
     PORT_CLASSES = (
         'gtk.GtkPort',
         'ios_simulator.IOSSimulatorPort',
+        'ios_simulator.IPhoneSimulatorPort',
+        'ios_simulator.IPadSimulatorPort',
         'ios_device.IOSDevicePort',
         'watch_simulator.WatchSimulatorPort',
         'watch_device.WatchDevicePort',

Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator.py (240162 => 240163)


--- trunk/Tools/Scripts/webkitpy/port/ios_simulator.py	2019-01-18 20:07:44 UTC (rev 240162)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator.py	2019-01-18 20:12:38 UTC (rev 240163)
@@ -109,3 +109,20 @@
 
     def stderr_patterns_to_strip(self):
         return []
+
+
+class IPhoneSimulatorPort(IOSSimulatorPort):
+    port_name = 'iphone-simulator'
+
+    DEVICE_TYPE = DeviceType(hardware_family='iPhone')
+    DEFAULT_DEVICE_TYPES = [
+        DeviceType(hardware_family='iPhone', hardware_type='SE'),
+        DeviceType(hardware_family='iPhone', hardware_type='7'),
+    ]
+
+
+class IPadSimulatorPort(IOSSimulatorPort):
+    port_name = 'ipad-simulator'
+
+    DEVICE_TYPE = DeviceType(hardware_family='iPad')
+    DEFAULT_DEVICE_TYPES = [DeviceType(hardware_family='iPad', hardware_type='(5th generation)')]
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to