Title: [255404] trunk/Tools
Revision
255404
Author
jbed...@apple.com
Date
2020-01-29 16:59:06 -0800 (Wed, 29 Jan 2020)

Log Message

run-safari / run-webkit-tests --ios-simulator not working with XCode 13.3.1 (11C504)
https://bugs.webkit.org/show_bug.cgi?id=206932

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager.get_runtime_for_device_type): Request for a device running
some version will return a runtime of the same major version with a minor version
that is equal to or greater than the specified minor version.
* Scripts/webkitpy/xcode/simulated_device_unittest.py:
(test_matching_up_success):
(test_matching_up_failure):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (255403 => 255404)


--- trunk/Tools/ChangeLog	2020-01-30 00:34:48 UTC (rev 255403)
+++ trunk/Tools/ChangeLog	2020-01-30 00:59:06 UTC (rev 255404)
@@ -1,3 +1,18 @@
+2020-01-29  Jonathan Bedard  <jbed...@apple.com>
+
+        run-safari / run-webkit-tests --ios-simulator not working with XCode 13.3.1 (11C504)
+        https://bugs.webkit.org/show_bug.cgi?id=206932
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDeviceManager.get_runtime_for_device_type): Request for a device running
+        some version will return a runtime of the same major version with a minor version
+        that is equal to or greater than the specified minor version.
+        * Scripts/webkitpy/xcode/simulated_device_unittest.py:
+        (test_matching_up_success):
+        (test_matching_up_failure):
+
 2020-01-28  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] Give up IC when unknown structure transition happens

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (255403 => 255404)


--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2020-01-30 00:34:48 UTC (rev 255403)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2020-01-30 00:59:06 UTC (rev 255404)
@@ -203,16 +203,19 @@
 
     @staticmethod
     def get_runtime_for_device_type(device_type):
+        # Search for an available runtime that best matches the provided device type
+        candidate = None
         for runtime in SimulatedDeviceManager.AVAILABLE_RUNTIMES:
-            if runtime.os_variant == device_type.software_variant and (device_type.software_version is None or device_type.software_version == runtime.version):
-                return runtime
+            if runtime.os_variant != device_type.software_variant:
+                continue
+            if device_type.software_version and runtime.version.major != device_type.software_version.major:
+                continue
+            if device_type.software_version and runtime.version < device_type.software_version:
+                continue
+            if not candidate or runtime.version < candidate.version:
+                candidate = runtime
+        return candidate
 
-        # Allow for a partial version match.
-        for runtime in SimulatedDeviceManager.AVAILABLE_RUNTIMES:
-            if runtime.os_variant == device_type.software_variant and runtime.version in device_type.software_version:
-                return runtime
-        return None
-
     @staticmethod
     def _disambiguate_device_type(device_type):
         # Copy by value since we do not want to modify the DeviceType passed in.

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py (255403 => 255404)


--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py	2020-01-30 00:34:48 UTC (rev 255403)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py	2020-01-30 00:59:06 UTC (rev 255404)
@@ -626,6 +626,23 @@
         SimulatedDeviceManager.tear_down(host)
         self.assertIsNone(SimulatedDeviceManager.INITIALIZED_DEVICES)
 
+    def test_matching_up_success(self):
+        SimulatedDeviceTest.reset_simulated_device_manager()
+        host = SimulatedDeviceTest.mock_host_for_simctl()
+        SimulatedDeviceManager.available_devices(host)
+
+        runtime = SimulatedDeviceManager.get_runtime_for_device_type(DeviceType.from_string('iphone 5s', Version(9, 2)))
+        self.assertEquals(runtime.os_variant, 'iOS')
+        self.assertEquals(runtime.version, Version(9, 3))
+
+    def test_matching_up_failure(self):
+        SimulatedDeviceTest.reset_simulated_device_manager()
+        host = SimulatedDeviceTest.mock_host_for_simctl()
+        SimulatedDeviceManager.available_devices(host)
+
+        runtime = SimulatedDeviceManager.get_runtime_for_device_type(DeviceType.from_string('iphone 5s', Version(9, 4)))
+        self.assertEquals(runtime, None)
+
     @staticmethod
     def change_state_to(device, state):
         assert isinstance(state, int)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to