Title: [189573] trunk/Tools
Revision
189573
Author
[email protected]
Date
2015-09-10 10:30:20 -0700 (Thu, 10 Sep 2015)

Log Message

[iOS] Teach run-webkit-tests how to parse simulator runtimes when version numbers contain a revision
https://bugs.webkit.org/show_bug.cgi?id=149022

Reviewed by Daniel Bates.

Simulator runtime versions can contain a revision number (e.g. 8.4.1), but the regex for matching runtimes
did not account for this.

* Scripts/webkitpy/xcode/simulator.py:
(Simulator): Optionally matched a revision at the end of a runtime version number.
* Scripts/webkitpy/xcode/simulator_unittest.py: Added a test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (189572 => 189573)


--- trunk/Tools/ChangeLog	2015-09-10 17:27:46 UTC (rev 189572)
+++ trunk/Tools/ChangeLog	2015-09-10 17:30:20 UTC (rev 189573)
@@ -1,5 +1,19 @@
 2015-09-09  Andy Estes  <[email protected]>
 
+        [iOS] Teach run-webkit-tests how to parse simulator runtimes when version numbers contain a revision
+        https://bugs.webkit.org/show_bug.cgi?id=149022
+
+        Reviewed by Daniel Bates.
+
+        Simulator runtime versions can contain a revision number (e.g. 8.4.1), but the regex for matching runtimes
+        did not account for this.
+
+        * Scripts/webkitpy/xcode/simulator.py:
+        (Simulator): Optionally matched a revision at the end of a runtime version number.
+        * Scripts/webkitpy/xcode/simulator_unittest.py: Added a test.
+
+2015-09-09  Andy Estes  <[email protected]>
+
         [iOS] Teach run-webkit-tests how to parse `simctl list` when a tvOS SDK is installed
         https://bugs.webkit.org/show_bug.cgi?id=149029
         <rdar://problem/22432624>

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator.py (189572 => 189573)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2015-09-10 17:27:46 UTC (rev 189572)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2015-09-10 17:30:20 UTC (rev 189573)
@@ -234,15 +234,18 @@
 #        We should find a better way to query for simulator device state and capabilities. Maybe take a similiar
 #        approach as in webkitdirs.pm and utilize the parsed output from the device.plist files in the sub-
 #        directories of ~/Library/Developer/CoreSimulator/Devices?
+#        Also, simctl has the option to output in JSON format (xcrun simctl list --json).
 class Simulator(object):
     """
     Represents the iOS Simulator infrastructure under the currently select Xcode.app bundle.
     """
     device_type_re = re.compile('(?P<name>[^(]+)\((?P<identifier>[^)]+)\)')
+    # FIXME: runtime_re parses the version from the runtime name, but that does not contain the full version number
+    # (it can omit the revision). We should instead parse the version from the number contained in parentheses.
     runtime_re = re.compile(
-        '(i|watch|tv)OS (?P<version>[0-9]+\.[0-9])(?P<internal> Internal)? \([0-9]+\.[0-9]+ - (?P<build_version>[^)]+)\) \((?P<identifier>[^)]+)\)( \((?P<availability>[^)]+)\))?')
+        '(i|watch|tv)OS (?P<version>\d+\.\d)(?P<internal> Internal)? \(\d+\.\d+(\.\d+)? - (?P<build_version>[^)]+)\) \((?P<identifier>[^)]+)\)( \((?P<availability>[^)]+)\))?')
     unavailable_version_re = re.compile('-- Unavailable: (?P<identifier>[^ ]+) --')
-    version_re = re.compile('-- (i|watch|tv)OS (?P<version>[0-9]+\.[0-9]+)(?P<internal> Internal)? --')
+    version_re = re.compile('-- (i|watch|tv)OS (?P<version>\d+\.\d+)(?P<internal> Internal)? --')
     devices_re = re.compile(
         '\s*(?P<name>[^(]+ )\((?P<udid>[^)]+)\) \((?P<state>[^)]+)\)( \((?P<availability>[^)]+)\))?')
 

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py (189572 => 189573)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2015-09-10 17:27:46 UTC (rev 189572)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2015-09-10 17:30:20 UTC (rev 189573)
@@ -52,6 +52,7 @@
 == Runtimes ==
 iOS 8.0 (8.0 - 12A465) (com.apple.CoreSimulator.SimRuntime.iOS-8-0)
 iOS 8.0 Internal (8.0 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-8-0-Internal) (unavailable, runtime path not found)
+iOS 8.4 (8.4.1 - 12H321) (com.apple.CoreSimulator.SimRuntime.iOS-8-4)
 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)
 == Devices ==
@@ -119,7 +120,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(4, len(simulator.runtimes))
+        self.assertEqual(5, len(simulator.runtimes))
 
         runtime_ios_8 = simulator.runtimes[0]
         self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-0', runtime_ios_8.identifier)
@@ -189,7 +190,14 @@
         self.assertEqual(tuple([8, 0]), runtime_ios_8_internal.version)
         self.assertEqual(0, len(runtime_ios_8_internal.devices))
 
-        runtime_tvos_9 = simulator.runtimes[2]
+        runtime_ios_8_4 = simulator.runtimes[2]
+        self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-4', runtime_ios_8_4.identifier)
+        self.assertEqual(True, runtime_ios_8_4.available)
+        self.assertEqual(False, runtime_ios_8_4.is_internal_runtime)
+        self.assertEqual(tuple([8, 4]), runtime_ios_8_4.version)
+        self.assertEqual(0, len(runtime_ios_8_4.devices))
+
+        runtime_tvos_9 = simulator.runtimes[3]
         self.assertEqual('com.apple.CoreSimulator.SimRuntime.tvOS-9-0', runtime_tvos_9.identifier)
         self.assertEqual(True, runtime_tvos_9.available)
         self.assertEqual(False, runtime_tvos_9.is_internal_runtime)
@@ -202,7 +210,7 @@
         self.assertEqual(True, device_apple_tv_1080p.available)
         self.assertEqual(runtime_tvos_9, device_apple_tv_1080p.runtime)
 
-        runtime_watchos_2 = simulator.runtimes[3]
+        runtime_watchos_2 = simulator.runtimes[4]
         self.assertEqual('com.apple.CoreSimulator.SimRuntime.watchOS-2-0', runtime_watchos_2.identifier)
         self.assertEqual(True, runtime_watchos_2.available)
         self.assertEqual(False, runtime_watchos_2.is_internal_runtime)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to