Title: [226214] trunk/Tools
Revision
226214
Author
[email protected]
Date
2017-12-20 20:37:55 -0800 (Wed, 20 Dec 2017)

Log Message

webkitpy: simctl cannot handle partial runtime version matches
https://bugs.webkit.org/show_bug.cgi?id=181055
<rdar://problem/36163798>

Reviewed by Alexey Proskuryakov.

A request for a simulator runtime of iOS 11 should be fulfilled by
iOS 11.0.1.

* Scripts/webkitpy/xcode/simulator.py:
(Simulator.runtime): Allow for partial matching of iOS runtime versions.
* Scripts/webkitpy/xcode/simulator_unittest.py:
(test_failed_partial_version_match): Test that partial version mapping does
not give false positives.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (226213 => 226214)


--- trunk/Tools/ChangeLog	2017-12-21 03:50:16 UTC (rev 226213)
+++ trunk/Tools/ChangeLog	2017-12-21 04:37:55 UTC (rev 226214)
@@ -1,3 +1,20 @@
+2017-12-20  Jonathan Bedard  <[email protected]>
+
+        webkitpy: simctl cannot handle partial runtime version matches
+        https://bugs.webkit.org/show_bug.cgi?id=181055
+        <rdar://problem/36163798>
+
+        Reviewed by Alexey Proskuryakov.
+
+        A request for a simulator runtime of iOS 11 should be fulfilled by
+        iOS 11.0.1.
+
+        * Scripts/webkitpy/xcode/simulator.py:
+        (Simulator.runtime): Allow for partial matching of iOS runtime versions.
+        * Scripts/webkitpy/xcode/simulator_unittest.py:
+        (test_failed_partial_version_match): Test that partial version mapping does
+        not give false positives.
+
 2017-12-20  Daniel Bates  <[email protected]>
 
         MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator.py (226213 => 226214)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2017-12-21 03:50:16 UTC (rev 226213)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2017-12-21 04:37:55 UTC (rev 226214)
@@ -410,6 +410,16 @@
             if identifier and runtime.identifier != identifier:
                 continue
             return runtime
+
+        # Allow for a partial version match
+        for runtime in self.runtimes:
+            if version and runtime.version not in version:
+                continue
+            if is_internal_runtime and runtime.is_internal_runtime != is_internal_runtime:
+                continue
+            if identifier and runtime.identifier != identifier:
+                continue
+            return runtime
         return None
 
     def find_device_by_udid(self, udid):

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py (226213 => 226214)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2017-12-21 03:50:16 UTC (rev 226213)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2017-12-21 04:37:55 UTC (rev 226214)
@@ -58,6 +58,7 @@
 tvOS 9.0 (9.0 - 13T5347l) (com.apple.CoreSimulator.SimRuntime.tvOS-9-0)
 watchOS 2.0 (2.0 - 13S343) (com.apple.CoreSimulator.SimRuntime.watchOS-2-0)
 iOS 10.0 (10.0 - 14280) - com.apple.CoreSimulator.SimRuntime.iOS-10-0
+iOS 11.0.1 (11.0.1 - 15280) - com.apple.CoreSimulator.SimRuntime.iOS-11-0
 == Devices ==
 -- iOS 8.0 --
     iPhone 4s (68D9A792-E3A9-462B-B211-762C6A5D3779) (Shutdown)
@@ -77,6 +78,8 @@
 -- watchOS 2.0 --
     Apple Watch - 38mm (00138CD2-D30C-4380-A30E-A70B88E1A3C5) (Shutdown)
     Apple Watch - 42mm (186AD85E-9BE5-4734-BC33-DF50484AAFF0) (Shutdown)
+-- iOS 11.0 --
+    iPhone 7 (48E6CA73-4BF7-4153-BEE2-736CD881FEBD) (Shutdown) (unavailable, runtime profile not found)
 ''')
         simulator = Simulator(host=self._host)
         self.assertEqual(12, len(simulator.device_types))
@@ -129,7 +132,7 @@
         self.assertEqual('Apple Watch - 42mm', device_type_apple_watch_42mm.name)
         self.assertEqual('com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm', device_type_apple_watch_42mm.identifier)
 
-        self.assertEqual(6, len(simulator.runtimes))
+        self.assertEqual(7, len(simulator.runtimes))
 
         runtime_ios_8 = simulator.runtimes[0]
         self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-0', runtime_ios_8.identifier)
@@ -332,6 +335,17 @@
         self.assertEqual(Version(8, 0), runtime_ios_8_internal.version)
         self.assertEqual(0, len(runtime_ios_8_internal.devices))
 
+    def test_failed_partial_version_match(self):
+        self._set_expected_xcrun_simctl_list('''== Device Types ==
+iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
+== Runtimes ==
+iOS 11.0.1 (11.0.1 - 15280) - com.apple.CoreSimulator.SimRuntime.iOS-11-0
+== Devices ==
+-- iOS 11.1 --
+iPhone 6 (48E6CA73-4BF7-4153-BEE2-736CD881FEBD) (Shutdown)
+        ''')
+        self.assertRaises(AssertionError, lambda: Simulator(host=self._host))
+
     def test_device_pairs(self):
         """ Tests that Device Pairs header does not cause parsing exception """
         self._set_expected_xcrun_simctl_list('''== Device Types ==
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to