Layout tests broke due to unexpected simctl output
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 May 2015 08:20:33 +0000 (08:20 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 May 2015 08:20:33 +0000 (08:20 +0000)
* Scripts/webkitpy/xcode/simulator.py:
(Simulator._parse_devices): Handle new Device Pairs header.
* Scripts/webkitpy/xcode/simulator_unittest.py:
(test_device_pairs): Add unit test for Device Pairs header.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/xcode/simulator.py
Tools/Scripts/webkitpy/xcode/simulator_unittest.py

index c8d017efdfc954813fee681f83b421fb0df642f2..a82812a22d4a8c54dd228720cbcdd6ab9f940216 100644 (file)
@@ -1,3 +1,12 @@
+2015-05-09  David Kilzer  <ddkilzer@apple.com>
+
+        Layout tests broke due to unexpected simctl output
+
+        * Scripts/webkitpy/xcode/simulator.py:
+        (Simulator._parse_devices): Handle new Device Pairs header.
+        * Scripts/webkitpy/xcode/simulator_unittest.py:
+        (test_device_pairs): Add unit test for Device Pairs header.
+
 2015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Remove convenience constructors for TextRun
index 06dcbba1da9c4f2acdda2c485e3bf9a2e1b74e4d..6e3dce721a8e4d95568229492aeb1aa4ea736e69 100644 (file)
@@ -368,7 +368,9 @@ class Simulator(object):
 
             device_match = self.devices_re.match(line)
             if not device_match:
-                raise RuntimeError('Expected an iOS Simulator device line, got "{}"'.format(line))
+                if line != '== Device Pairs ==':
+                    raise RuntimeError('Expected == Device Pairs == header but got: "{}"'.format(line))
+                break
             if current_runtime:
                 device = Device(name=device_match.group('name').rstrip(),
                                 udid=device_match.group('udid'),
index c4250241eb719d574a1e5abac8b3d847910523c3..fe0e50bd8253f8788b835d6abeb4b4c7f9b24cdd 100644 (file)
@@ -241,3 +241,37 @@ iOS 8.0 Internal (8.0 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-8-0-Int
         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))
+
+    def test_device_pairs(self):
+        """ Tests that Device Pairs header does not cause parsing exception """
+        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)
+== Device Pairs ==
+''')
+        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)