Title: [179793] trunk/Tools
Revision
179793
Author
[email protected]
Date
2015-02-07 19:26:51 -0800 (Sat, 07 Feb 2015)

Log Message

[iOS] run-webkit-tests fails due to simulator devices from previous SDK installs being marked as unavailable
<http://webkit.org/b/141365>

Reviewed by Daniel Bates.

* Scripts/webkitpy/xcode/simulator.py:
(Simulator): Add unavailable_version_re precompiled regex.
(Simulator._parse_devices): Check for unavailable versions and
ignore them if found when parsing the output of
`xcrun simctl list`.
* Scripts/webkitpy/xcode/simulator_unittest.py:
(test_unavailable_devices): Add test with output from
`xcrun simctl list` with unavailable runtimes that fails before
the fix.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (179792 => 179793)


--- trunk/Tools/ChangeLog	2015-02-08 02:43:40 UTC (rev 179792)
+++ trunk/Tools/ChangeLog	2015-02-08 03:26:51 UTC (rev 179793)
@@ -1,3 +1,20 @@
+2015-02-07  David Kilzer  <[email protected]>
+
+        [iOS] run-webkit-tests fails due to simulator devices from previous SDK installs being marked as unavailable
+        <http://webkit.org/b/141365>
+
+        Reviewed by Daniel Bates.
+
+        * Scripts/webkitpy/xcode/simulator.py:
+        (Simulator): Add unavailable_version_re precompiled regex.
+        (Simulator._parse_devices): Check for unavailable versions and
+        ignore them if found when parsing the output of
+        `xcrun simctl list`.
+        * Scripts/webkitpy/xcode/simulator_unittest.py:
+        (test_unavailable_devices): Add test with output from
+        `xcrun simctl list` with unavailable runtimes that fails before
+        the fix.
+
 2015-02-07  Chris Dumez  <[email protected]>
 
         Add Vector::removeFirstMatching() / removeAllMatching() methods taking lambda functions

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator.py (179792 => 179793)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2015-02-08 02:43:40 UTC (rev 179792)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator.py	2015-02-08 03:26:51 UTC (rev 179793)
@@ -236,6 +236,7 @@
     device_type_re = re.compile('(?P<name>[^(]+)\((?P<identifier>[^)]+)\)')
     runtime_re = re.compile(
         'iOS (?P<version>[0-9]+\.[0-9])(?P<internal> Internal)? \([0-9]+\.[0-9]+ - (?P<build_version>[^)]+)\) \((?P<identifier>[^)]+)\)( \((?P<availability>[^)]+)\))?')
+    unavailable_version_re = re.compile('-- Unavailable: (?P<identifier>[^ ]+) --')
     version_re = re.compile('-- iOS (?P<version>[0-9]+\.[0-9]+)(?P<internal> Internal)? --')
     devices_re = re.compile(
         '\s*(?P<name>[^(]+ )\((?P<udid>[^)]+)\) \((?P<state>[^)]+)\)( \((?P<availability>[^)]+)\))?')
@@ -337,14 +338,21 @@
                 current_runtime = self.runtime(version=version, is_internal_runtime=bool(version_match.group('internal')))
                 assert current_runtime
                 continue
+
+            unavailable_version_match = self.unavailable_version_re.match(line)
+            if unavailable_version_match:
+                current_runtime = None
+                continue
+
             device_match = self.devices_re.match(line)
             if not device_match:
                 raise RuntimeError('Expected an iOS Simulator device line, got "{}"'.format(line))
-            device = Device(name=device_match.group('name').rstrip(),
-                            udid=device_match.group('udid'),
-                            available=device_match.group('availability') is None,
-                            runtime=current_runtime)
-            current_runtime.devices.append(device)
+            if current_runtime:
+                device = Device(name=device_match.group('name').rstrip(),
+                                udid=device_match.group('udid'),
+                                available=device_match.group('availability') is None,
+                                runtime=current_runtime)
+                current_runtime.devices.append(device)
 
     def device_type(self, name=None, identifier=None):
         """

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py (179792 => 179793)


--- trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2015-02-08 02:43:40 UTC (rev 179792)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulator_unittest.py	2015-02-08 03:26:51 UTC (rev 179793)
@@ -196,3 +196,48 @@
         with self.assertRaises(RuntimeError) as cm:
             Simulator(host=self._host)
         self.assertEqual('Expected == Devices == header but got: "XX Devices XX"', cm.exception.message)
+
+    def test_unavailable_devices(self):
+        """ Tests that unavailable devices are ignored """
+        self._set_expected_xcrun_simctl_list('''== Device Types ==
+iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
+== 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)
+== Devices ==
+-- iOS 8.0 --
+    iPhone 4s (271BBEAC-1826-4CE1-B3AF-83F35CDD1D82) (Shutdown)
+-- iOS 8.0 Internal --
+-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-1 --
+    iPhone 4s (08C0542B-65F7-46E8-B203-CB4055207BC8) (Shutdown) (unavailable, runtime profile not found)
+-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-2 --
+    iPhone 4s (A36F7432-0AF5-49C4-A261-C44383992597) (Shutdown) (unavailable, runtime profile not found)
+''')
+        simulator = Simulator(host=self._host)
+        self.assertEqual(1, len(simulator.device_types))
+
+        device_type_iphone_4s = simulator.device_types[0]
+        self.assertEqual('iPhone 4s', device_type_iphone_4s.name)
+        self.assertEqual('com.apple.CoreSimulator.SimDeviceType.iPhone-4s', device_type_iphone_4s.identifier)
+
+        self.assertEqual(2, len(simulator.runtimes))
+
+        runtime_ios_8 = simulator.runtimes[0]
+        self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-0', runtime_ios_8.identifier)
+        self.assertEqual(True, runtime_ios_8.available)
+        self.assertEqual(False, runtime_ios_8.is_internal_runtime)
+        self.assertEqual(tuple([8, 0]), runtime_ios_8.version)
+        self.assertEqual(1, len(runtime_ios_8.devices))
+
+        device_iphone_4s = runtime_ios_8.devices[0]
+        self.assertEqual('iPhone 4s', device_iphone_4s.name)
+        self.assertEqual('271BBEAC-1826-4CE1-B3AF-83F35CDD1D82', device_iphone_4s.udid)
+        self.assertEqual(True, device_iphone_4s.available)
+        self.assertEqual(runtime_ios_8, device_iphone_4s.runtime)
+
+        runtime_ios_8_internal = simulator.runtimes[1]
+        self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-0-Internal', runtime_ios_8_internal.identifier)
+        self.assertEqual(False, runtime_ios_8_internal.available)
+        self.assertEqual(True, runtime_ios_8_internal.is_internal_runtime)
+        self.assertEqual(tuple([8, 0]), runtime_ios_8_internal.version)
+        self.assertEqual(0, len(runtime_ios_8_internal.devices))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to