Title: [219875] trunk/Tools
Revision
219875
Author
jbed...@apple.com
Date
2017-07-25 11:28:34 -0700 (Tue, 25 Jul 2017)

Log Message

Replace --runtime with something for both ios-simulator and ios-device
https://bugs.webkit.org/show_bug.cgi?id=173775
<rdar://problem/32952164>

Reviewed by Aakash Jain.

Add --version flag for both iOS simulator and iOS device.

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args): Add --version flag and move --no-install.
* Scripts/webkitpy/port/factory.py:
(platform_options): Move --no-intall to run_webkit_tests.py.
* Scripts/webkitpy/port/ios.py:
(IOSPort):
(IOSPort._is_valid_ios_version): Check that the provided version string is legal.
(IOSPort.get_option): If accessing the iOS version, check that it is a valid version string.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort.ios_version): Consult --version flag before checking connected
devices for iOS version.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.make_port): Set --version option so that we can generate test
expectation paths without devices connected.
(IOSDeviceTest.test_additional_platform_directory): Deleted.
(IOSDeviceTest.test_baseline_searchpath): Deleted.
(IOSDeviceTest.test_expectations_ordering): Deleted.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.simulator_runtime): If no runtime is specified, use the --version
flag to specify a runtime.
(IOSSimulatorPort.ios_version): First check the --version flag, then the --runtime
flag and then use the default runtime.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219874 => 219875)


--- trunk/Tools/ChangeLog	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/ChangeLog	2017-07-25 18:28:34 UTC (rev 219875)
@@ -1,3 +1,36 @@
+2017-07-25  Jonathan Bedard  <jbed...@apple.com>
+
+        Replace --runtime with something for both ios-simulator and ios-device
+        https://bugs.webkit.org/show_bug.cgi?id=173775
+        <rdar://problem/32952164>
+
+        Reviewed by Aakash Jain.
+
+        Add --version flag for both iOS simulator and iOS device.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args): Add --version flag and move --no-install.
+        * Scripts/webkitpy/port/factory.py:
+        (platform_options): Move --no-intall to run_webkit_tests.py.
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort):
+        (IOSPort._is_valid_ios_version): Check that the provided version string is legal.
+        (IOSPort.get_option): If accessing the iOS version, check that it is a valid version string.
+        * Scripts/webkitpy/port/ios_device.py:
+        (IOSDevicePort.ios_version): Consult --version flag before checking connected
+        devices for iOS version.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest.make_port): Set --version option so that we can generate test
+        expectation paths without devices connected.
+        (IOSDeviceTest.test_additional_platform_directory): Deleted.
+        (IOSDeviceTest.test_baseline_searchpath): Deleted.
+        (IOSDeviceTest.test_expectations_ordering): Deleted.
+        * Scripts/webkitpy/port/ios_simulator.py:
+        (IOSSimulatorPort.simulator_runtime): If no runtime is specified, use the --version
+        flag to specify a runtime.
+        (IOSSimulatorPort.ios_version): First check the --version flag, then the --runtime
+        flag and then use the default runtime.
+
 2017-07-25  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] TestWebKitAPI tests are no longer built since the WebKit2 rename

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -291,7 +291,10 @@
                  '"weston": Use a virtualized Weston server. "wayland": Use the current wayland session.'),
     ]))
 
-    option_group_definitions.append(("iOS Simulator Options", [
+    option_group_definitions.append(("iOS Options", [
+        optparse.make_option('--no-install', action='', const=False, default=True, dest='install',
+            help='Skip install step for device and simulator testing'),
+        optparse.make_option('--version', help='Specify the version of iOS to be used. By default, this will adopt the runtime for iOS Simulator.'),
         optparse.make_option('--runtime', help='iOS Simulator runtime identifier (default: latest runtime)'),
         optparse.make_option('--device-type', help='iOS Simulator device type identifier (default: i386 -> iPhone 5, x86_64 -> iPhone 5s)'),
         optparse.make_option('--dedicated-simulators', action="" default=False,

Modified: trunk/Tools/Scripts/webkitpy/port/factory.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/port/factory.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/port/factory.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -56,9 +56,6 @@
         optparse.make_option('--wpe', action='', dest='platform',
             const=('wpe*' if use_globs else 'wpe'),
             help=('Alias for --platform=wpe')),
-        optparse.make_option('--no-install', action='',
-            const=False, default=True, dest='install',
-            help='Skip install step for device and simulator testing'),
         ] + (config.apple_additions().platform_options() if config.apple_additions() else [])
 
 

Modified: trunk/Tools/Scripts/webkitpy/port/ios.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/port/ios.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/port/ios.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -105,6 +105,22 @@
     def test_expectations_file_position(self):
         return 4
 
+    @staticmethod
+    def _is_valid_ios_version(version_identifier):
+        # Examples of valid versions: '11', '10.3', '10.3.1'
+        if not version_identifier:
+            return False
+        split_by_period = version_identifier.split('.')
+        if len(split_by_period) > 3:
+            return False
+        return all(part.isdigit() for part in split_by_period)
+
+    def get_option(self, name, default_value=None):
+        result = super(IOSPort, self).get_option(name, default_value)
+        if name == 'version' and result and not IOSPort._is_valid_ios_version(result):
+            raise RuntimeError('{} is an invalid iOS version'.format(result))
+        return result
+
     def ios_version(self):
         raise NotImplementedError
 

Modified: trunk/Tools/Scripts/webkitpy/port/ios_device.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/port/ios_device.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -93,12 +93,13 @@
 
     @memoized
     def ios_version(self):
+        if self.get_option('version'):
+            return self.get_option('version')
+
         if not apple_additions():
             raise RuntimeError(self.NO_ON_DEVICE_TESTING)
 
-        # FIXME: We should replace --runtime with something which makes sense for both Simulator and Device
-        # https://bugs.webkit.org/show_bug.cgi?id=173775
-        if len(self._device_for_worker_number_map()) == 0:
+        if not self._device_for_worker_number_map():
             raise RuntimeError('No devices are available')
         version = None
         for device in self._device_for_worker_number_map():

Modified: trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -36,6 +36,7 @@
 
     def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
         port = super(IOSDeviceTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs)
+        port.set_option('version', '11.0')
         return port
 
     def test_operating_system(self):
@@ -87,13 +88,3 @@
         port = self.make_port(port_name=self.port_name)
         with self.assertRaises(RuntimeError):
             port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
-
-    # FIXME: https://bugs.webkit.org/show_bug.cgi?id=173775
-    def test_additional_platform_directory(self):
-        pass
-
-    def test_baseline_searchpath(self):
-        pass
-
-    def test_expectations_ordering(self):
-        pass

Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator.py (219874 => 219875)


--- trunk/Tools/Scripts/webkitpy/port/ios_simulator.py	2017-07-25 18:03:02 UTC (rev 219874)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator.py	2017-07-25 18:28:34 UTC (rev 219875)
@@ -101,6 +101,8 @@
         runtime_identifier = self.get_option('runtime')
         if runtime_identifier:
             runtime = Runtime.from_identifier(runtime_identifier)
+        elif self.get_option('version'):
+            runtime = Runtime.from_version_string(self.get_option('version'))
         else:
             runtime = Runtime.from_version_string(self.host.platform.xcode_sdk_version('iphonesimulator'))
         return runtime
@@ -107,9 +109,9 @@
 
     @memoized
     def ios_version(self):
-        # FIXME: We should replace --runtime with something which makes sense for both Simulator and Device
-        # https://bugs.webkit.org/show_bug.cgi?id=173775
         runtime_identifier = self.get_option('runtime')
+        if self.get_option('version'):
+            return self.get_option('version')
         if runtime_identifier:
             return '.'.join(str(i) for i in Runtime.from_identifier(runtime_identifier).version)
         return self.host.platform.xcode_sdk_version('iphonesimulator')
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to