Changeset 240163 in webkit


Ignore:
Timestamp:
Jan 18, 2019 12:12:38 PM (5 years ago)
Author:
Jonathan Bedard
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):

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r240161 r240163  
     12019-01-18  Jonathan Bedard  <jbedard@apple.com>
     2
     3        webkitpy: Add iPhone and iPad ports
     4        https://bugs.webkit.org/show_bug.cgi?id=193537
     5        <rdar://problem/47353390>
     6
     7        Reviewed by Lucas Forschler.
     8
     9        Add --iphone-simulator and --ipad-simulator commands to run-webkit-tests which separate iPhone and iPad into separate
     10        ports. Note that this separation is optional, the --ios-simulator command remains.
     11
     12        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     13        (RunTest.test_device_type_test_division): Drive-by fix.
     14        (RunTest.test_device_type_specific_listing): Ditto.
     15        (RunTest.test_ipad_test_division):
     16        (RunTest):
     17        (RunTest.test_ipad_listing):
     18        * Scripts/webkitpy/port/factory.py:
     19        (platform_options): Add --iphone-simulator and --ipad-simulator flags.
     20        (PortFactory):
     21        * Scripts/webkitpy/port/ios_simulator.py:
     22        (IPhoneSimulatorPort):
     23        (IPadSimulatorPort):
     24
    1252019-01-18  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r240150 r240163  
    2929# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3030
    31 import codecs
    3231import json
    33 import logging
    34 import os
    35 import platform
    36 import Queue
    37 import re
    3832import StringIO
    39 import sys
    40 import thread
    41 import time
    42 import threading
    4333import unittest
    4434
     
    4939from webkitpy.common.host_mock import MockHost
    5040
    51 from webkitpy import port
    5241from webkitpy.layout_tests import run_webkit_tests
    5342from webkitpy.layout_tests.models.test_run_results import INTERRUPTED_EXIT_STATUS
    54 from webkitpy.port import Port
    5543from webkitpy.port import test
    56 from webkitpy.test.skip import skip_if
    5744from webkitpy.xcode.device_type import DeviceType
    5845
     
    858845            if str(DeviceType.from_string('iPhone SE')) in line:
    859846                self.assertTrue('Skipping 2 tests' in line)
    860             elif str(DeviceType.from_string('iPhone (5th generation)')) in line:
     847            elif str(DeviceType.from_string('iPad (5th generation)')) in line:
    861848                self.assertTrue('Skipping 1 test' in line)
    862849            elif str(DeviceType.from_string('iPhone 7')) in line:
     
    882869        by_type = {}
    883870        for line in output.splitlines():
    884             if not line:
     871            if not line or 'skip' in line:
    885872                continue
    886873            if 'Tests to run' in line:
     
    894881        self.assertEqual(1, len(by_type[DeviceType.from_string('iPad (5th generation)')]))
    895882        self.assertEqual(0, len(by_type[DeviceType.from_string('iPhone 7')]))
     883
     884    def test_ipad_test_division(self):
     885        host = MockHost()
     886        port = host.port_factory.get('ipad-simulator')
     887
     888        host.filesystem.write_text_file('/mock-checkout/LayoutTests/test1.html', '')
     889        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ios/test2.html', '')
     890        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ipad/test3.html', '')
     891        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/iphone/test4.html', '')
     892        host.filesystem.write_text_file('/MOCK output of child process/ImageDiff', '')
     893
     894        oc = outputcapture.OutputCapture()
     895        try:
     896            oc.capture_output()
     897            logging = StringIO.StringIO()
     898            run_webkit_tests.run(port, run_webkit_tests.parse_args(['--debug-rwt-logging', '-n', '--no-build', '--root', '/build'])[0], [], logging_stream=logging)
     899        finally:
     900            output, err, _ = oc.restore_output()
     901
     902        for line in logging.getvalue():
     903            if str(DeviceType.from_string('iPad (5th generation)')) in line:
     904                self.assertTrue('Skipping 3 test' in line)
     905
     906    def test_ipad_listing(self):
     907        host = MockHost()
     908        port = host.port_factory.get('ipad-simulator')
     909
     910        host.filesystem.write_text_file('/mock-checkout/LayoutTests/test1.html', '')
     911        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ios/test2.html', '')
     912        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/ipad/test3.html', '')
     913        host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/iphone/test4.html', '')
     914
     915        oc = outputcapture.OutputCapture()
     916        try:
     917            oc.capture_output()
     918            logging = StringIO.StringIO()
     919            run_webkit_tests._print_expectations(port, run_webkit_tests.parse_args([])[0], [], logging_stream=logging)
     920        finally:
     921            output, _, _ = oc.restore_output()
     922
     923        current_type = None
     924        by_type = {}
     925        for line in output.splitlines():
     926            if not line or 'skip' in line:
     927                continue
     928            if 'Tests to run' in line:
     929                current_type = DeviceType.from_string(line.split('for ')[-1].split(' running')[0]) if 'for ' in line else None
     930                by_type[current_type] = []
     931                continue
     932            by_type[current_type].append(line)
     933
     934        self.assertEqual(1, len(by_type.keys()))
     935        self.assertEqual(3, len(by_type[DeviceType.from_string('iPad (5th generation)')]))
    896936
    897937
  • trunk/Tools/Scripts/webkitpy/port/factory.py

    r238590 r240163  
    4848            const=('ios-simulator'),
    4949            help=('Alias for --platform=ios-simulator')),
     50        optparse.make_option('--iphone-simulator', action='store_const', dest='platform',
     51            const=('iphone-simulator'),
     52            help=('Alias for --platform=iphone-simulator')),
     53        optparse.make_option('--ipad-simulator', action='store_const', dest='platform',
     54            const=('ipad-simulator'),
     55            help=('Alias for --platform=ipad-simulator')),
    5056        optparse.make_option('--simulator', action='store_const', dest='platform',
    5157            const=('ios-simulator'),
     
    9197        'gtk.GtkPort',
    9298        'ios_simulator.IOSSimulatorPort',
     99        'ios_simulator.IPhoneSimulatorPort',
     100        'ios_simulator.IPadSimulatorPort',
    93101        'ios_device.IOSDevicePort',
    94102        'watch_simulator.WatchSimulatorPort',
  • trunk/Tools/Scripts/webkitpy/port/ios_simulator.py

    r240150 r240163  
    110110    def stderr_patterns_to_strip(self):
    111111        return []
     112
     113
     114class IPhoneSimulatorPort(IOSSimulatorPort):
     115    port_name = 'iphone-simulator'
     116
     117    DEVICE_TYPE = DeviceType(hardware_family='iPhone')
     118    DEFAULT_DEVICE_TYPES = [
     119        DeviceType(hardware_family='iPhone', hardware_type='SE'),
     120        DeviceType(hardware_family='iPhone', hardware_type='7'),
     121    ]
     122
     123
     124class IPadSimulatorPort(IOSSimulatorPort):
     125    port_name = 'ipad-simulator'
     126
     127    DEVICE_TYPE = DeviceType(hardware_family='iPad')
     128    DEFAULT_DEVICE_TYPES = [DeviceType(hardware_family='iPad', hardware_type='(5th generation)')]
Note: See TracChangeset for help on using the changeset viewer.