Title: [282625] trunk/Tools
Revision
282625
Author
[email protected]
Date
2021-09-16 18:16:04 -0700 (Thu, 16 Sep 2021)

Log Message

Exception in run-webkit-tests: Bad file descriptor (Part 4)
https://bugs.webkit.org/show_bug.cgi?id=229994
<rdar://problem/82826083>

Reviewed by Stephanie Lewis.

* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess):
(SimulatorProcess._start): Retry app start if OSError is caught when constructing stdout/stdin/stderr.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (282624 => 282625)


--- trunk/Tools/ChangeLog	2021-09-17 01:04:59 UTC (rev 282624)
+++ trunk/Tools/ChangeLog	2021-09-17 01:16:04 UTC (rev 282625)
@@ -1,3 +1,15 @@
+2021-09-16  Jonathan Bedard  <[email protected]>
+
+        Exception in run-webkit-tests: Bad file descriptor (Part 4)
+        https://bugs.webkit.org/show_bug.cgi?id=229994
+        <rdar://problem/82826083>
+
+        Reviewed by Stephanie Lewis.
+
+        * Scripts/webkitpy/port/simulator_process.py:
+        (SimulatorProcess):
+        (SimulatorProcess._start): Retry app start if OSError is caught when constructing stdout/stdin/stderr.
+
 2021-09-16  Megan Gardner  <[email protected]>
 
         Fix TestWebKitAPI.WebKit.AppHighlightsInImageOverlays to work with changing menu states.

Modified: trunk/Tools/Scripts/webkitpy/port/simulator_process.py (282624 => 282625)


--- trunk/Tools/Scripts/webkitpy/port/simulator_process.py	2021-09-17 01:04:59 UTC (rev 282624)
+++ trunk/Tools/Scripts/webkitpy/port/simulator_process.py	2021-09-17 01:16:04 UTC (rev 282625)
@@ -31,6 +31,7 @@
 
 
 class SimulatorProcess(ServerProcess):
+    RETRY = 3
 
     class Popen(object):
 
@@ -106,26 +107,36 @@
 
         # FIXME <rdar://problem/57032042>: This timeout should be 15 seconds
         with Timeout(30, handler=RuntimeError('Timed out waiting for pid {} to connect at port {}'.format(self._pid, self._target_host.listening_port())), patch=False):
-            stdin = None
-            stdout = None
-            stderr = None
-            try:
-                # This order matches the client side connections in Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp setUpIOSLayoutTestCommunication()
-                stdin = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'wb')
-                stdout = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'rb')
-                stderr = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'rb')
-            except:
-                # We set self._proc as _reset() and _kill() depend on it.
-                self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
-                if self._proc.poll() is not None:
+            for _ in range(self.RETRY):
+                stdin = None
+                stdout = None
+                stderr = None
+                try:
+                    # This order matches the client side connections in Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp setUpIOSLayoutTestCommunication()
+                    stdin = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'wb')
+                    stdout = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'rb')
+                    stderr = SimulatorProcess._accept_connection_create_file(self._target_host.listening_socket, 'rb')
+
+                    self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
+                    return
+
+                except OSError:
+                    self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
+                    self._target_host.executive.kill_process(self._proc.pid)
                     self._reset()
-                    raise Exception('App {} with pid {} crashed before stdin could be attached'.format(os.path.basename(self._cmd[0]), self._pid))
-                self._kill()
-                self._reset()
-                raise
 
-        self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
+                except:
+                    # We set self._proc as _reset() and _kill() depend on it.
+                    self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._target_host)
+                    if self._proc.poll() is not None:
+                        self._reset()
+                        raise Exception('App {} with pid {} crashed before stdin could be attached'.format(os.path.basename(self._cmd[0]), self._pid))
+                    self._kill()
+                    self._reset()
+                    raise
 
+        raise Exception('Failed to start app {} after {} retries'.format(self._cmd[0], self.RETRY))
+
     def stop(self, timeout_secs=3.0):
         # Only bother to check for leaks or stderr if the process is still running.
         if self.poll() is None:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to