Add support for different versions of iOS when loading test expectations
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 15:33:16 +0000 (15:33 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 15:33:16 +0000 (15:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173774
<rdar://problem/32951132>

Rubber-stamped by Aakash Jain.

When running layout tests, we should support multiple version of iOS the same way we do Mac.

* Scripts/webkitpy/port/ios.py:
(IOSPort.default_baseline_search_path): Add ios-<major version> test expectation.
(IOSPort.test_expectations_file_position): Added new file expectations, increment expected file position.
(IOSPort.ios_version): iOS ports must define a function to retrieve the iOS version.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort.ios_version): Ask connected devices for implementation.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_additional_platform_directory): Skip test until bug 173775 is finished.
(IOSDeviceTest.test_baseline_searchpath): Ditto.
(IOSDeviceTest.test_expectations_ordering): Ditto.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.ios_version): If a runtime is specified, ask the runtime for the iOS version. Otherwise,
ask the platform.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218996 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/ios.py
Tools/Scripts/webkitpy/port/ios_device.py
Tools/Scripts/webkitpy/port/ios_device_unittest.py
Tools/Scripts/webkitpy/port/ios_simulator.py

index 5e149c8..c56a815 100644 (file)
@@ -1,3 +1,27 @@
+2017-06-30  Jonathan Bedard  <jbedard@apple.com>
+
+        Add support for different versions of iOS when loading test expectations
+        https://bugs.webkit.org/show_bug.cgi?id=173774
+        <rdar://problem/32951132>
+
+        Rubber-stamped by Aakash Jain.
+
+        When running layout tests, we should support multiple version of iOS the same way we do Mac.
+
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort.default_baseline_search_path): Add ios-<major version> test expectation.
+        (IOSPort.test_expectations_file_position): Added new file expectations, increment expected file position.
+        (IOSPort.ios_version): iOS ports must define a function to retrieve the iOS version.
+        * Scripts/webkitpy/port/ios_device.py:
+        (IOSDevicePort.ios_version): Ask connected devices for implementation.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest.test_additional_platform_directory): Skip test until bug 173775 is finished.
+        (IOSDeviceTest.test_baseline_searchpath): Ditto.
+        (IOSDeviceTest.test_expectations_ordering): Ditto.
+        * Scripts/webkitpy/port/ios_simulator.py:
+        (IOSSimulatorPort.ios_version): If a runtime is specified, ask the runtime for the iOS version. Otherwise,
+        ask the platform.
+
 2017-06-30  Jacobo Aragunde PĂ©rez  <jaragunde@igalia.com>
 
         Fontconfig build breaks with glibc 2.15+
index dda1b50..68daf83 100644 (file)
@@ -93,6 +93,7 @@ class IOSPort(DarwinPort):
         fallback_names = [
             '{}-{}'.format(self.port_name, wk_string),
             self.port_name,
+            '{}-{}'.format(IOSPort.port_name, self.ios_version().split('.')[0]),
             '{}-{}'.format(IOSPort.port_name, wk_string),
             IOSPort.port_name,
         ]
@@ -102,7 +103,10 @@ class IOSPort(DarwinPort):
         return map(self._webkit_baseline_path, fallback_names)
 
     def test_expectations_file_position(self):
-        return 3
+        return 4
+
+    def ios_version(self):
+        raise NotImplementedError
 
     def _create_devices(self, device_class):
         raise NotImplementedError
index 479182a..1a195e9 100644 (file)
@@ -91,6 +91,25 @@ class IOSDevicePort(IOSPort):
                 return (stderr, crashlog)
         return (stderr, None)
 
+    @memoized
+    def ios_version(self):
+        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:
+            raise RuntimeError('No devices are available')
+        version = None
+        for device in self._device_for_worker_number_map():
+            if not version:
+                version = device.platform.os_version
+            else:
+                if device.platform.os_version != version:
+                    raise RuntimeError('Multiple connected devices have different iOS versions')
+
+        return version
+
     # FIXME: These need device implementations <rdar://problem/30497991>.
     def check_for_leaks(self, process_name, process_pid):
         pass
index f3faf0e..c888ecc 100644 (file)
@@ -87,3 +87,13 @@ class IOSDeviceTest(ios_testcase.IOSTest):
         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
index 27ebf1c..69b7776 100644 (file)
@@ -100,6 +100,14 @@ class IOSSimulatorPort(IOSPort):
             runtime = Runtime.from_version_string(self.host.platform.xcode_sdk_version('iphonesimulator'))
         return runtime
 
+    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 runtime_identifier:
+            return '.'.join(str(i) for i in Runtime.from_identifier(runtime_identifier).version)
+        return self.host.platform.xcode_sdk_version('iphonesimulator')
+
     def simulator_device_type(self):
         device_type_identifier = self.get_option('device_type')
         if device_type_identifier: