Title: [277531] trunk/Tools
Revision
277531
Author
jbed...@apple.com
Date
2021-05-14 21:58:16 -0700 (Fri, 14 May 2021)

Log Message

[run-webkit-tests] Handle missing simulator state plist
https://bugs.webkit.org/show_bug.cgi?id=225833
<rdar://problem/78036930>

Rubber-stamped by Aakash Jain.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDevice.state): If no device plist is found, assume the device is shut down.
* Scripts/webkitpy/xcode/simulated_device_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (277530 => 277531)


--- trunk/Tools/ChangeLog	2021-05-15 04:18:38 UTC (rev 277530)
+++ trunk/Tools/ChangeLog	2021-05-15 04:58:16 UTC (rev 277531)
@@ -1,5 +1,17 @@
 2021-05-14  Jonathan Bedard  <jbed...@apple.com>
 
+        [run-webkit-tests] Handle missing simulator state plist
+        https://bugs.webkit.org/show_bug.cgi?id=225833
+        <rdar://problem/78036930>
+
+        Rubber-stamped by Aakash Jain.
+
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDevice.state): If no device plist is found, assume the device is shut down.
+        * Scripts/webkitpy/xcode/simulated_device_unittest.py:
+
+2021-05-14  Jonathan Bedard  <jbed...@apple.com>
+
         Fix iOS 14.5 embedded build
         https://bugs.webkit.org/show_bug.cgi?id=225835
         <rdar://problem/78039315>

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (277530 => 277531)


--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2021-05-15 04:18:38 UTC (rev 277530)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2021-05-15 04:58:16 UTC (rev 277531)
@@ -561,7 +561,11 @@
             return self._state
 
         device_plist = self.filesystem.expanduser(self.filesystem.join(SimulatedDeviceManager.simulator_device_path, self.udid, 'device.plist'))
-        self._state = int(readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state'])
+        try:
+            self._state = int(readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state'])
+        except IOError:
+            self._state = SimulatedDevice.DeviceState.SHUTTING_DOWN
+
         self._last_updated_state = time.time()
         return self._state
 

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py (277530 => 277531)


--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py	2021-05-15 04:18:38 UTC (rev 277530)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py	2021-05-15 04:58:16 UTC (rev 277531)
@@ -678,3 +678,12 @@
         SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.INITIALIZED_DEVICES[0], SimulatedDevice.DeviceState.SHUT_DOWN)
         SimulatedDeviceManager.tear_down(host)
         self.assertIsNone(SimulatedDeviceManager.INITIALIZED_DEVICES)
+
+    def test_no_state_files(self):
+        SimulatedDeviceTest.reset_simulated_device_manager()
+        host = SimulatedDeviceTest.mock_host_for_simctl()
+        host.filesystem = MockFileSystem()
+        devices = SimulatedDeviceManager.available_devices(host)
+
+        for device in devices:
+            self.assertEquals(SimulatedDevice.DeviceState.SHUT_DOWN, device.state(force_update=True))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to