Title: [233834] trunk/Tools
Revision
233834
Author
[email protected]
Date
2018-07-13 23:48:09 -0700 (Fri, 13 Jul 2018)

Log Message

[WinCairo] run-api-tests is timing out for almost all test cases
https://bugs.webkit.org/show_bug.cgi?id=187547

Reviewed by Fujii Hironori.

* Scripts/webkitpy/port/server_process.py:
(ServerProcess._wait_for_data_and_update_buffers_using_win32_apis):
Still attempt to read from stdout/stderr even if the process has exited, as long as it's before the deadline.

* Scripts/webkitpy/port/server_process_unittest.py:
(TestServerProcess.test_read_after_process_exits):
Add test case.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (233833 => 233834)


--- trunk/Tools/ChangeLog	2018-07-14 02:15:49 UTC (rev 233833)
+++ trunk/Tools/ChangeLog	2018-07-14 06:48:09 UTC (rev 233834)
@@ -1,3 +1,18 @@
+2018-07-13  Ross Kirsling  <[email protected]>
+
+        [WinCairo] run-api-tests is timing out for almost all test cases
+        https://bugs.webkit.org/show_bug.cgi?id=187547
+
+        Reviewed by Fujii Hironori.
+
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess._wait_for_data_and_update_buffers_using_win32_apis):
+        Still attempt to read from stdout/stderr even if the process has exited, as long as it's before the deadline.
+
+        * Scripts/webkitpy/port/server_process_unittest.py:
+        (TestServerProcess.test_read_after_process_exits):
+        Add test case.
+
 2018-07-13  Ryan Haddad  <[email protected]>
 
         Add TestExpectations and baselines for iOS 12

Modified: trunk/Tools/Scripts/webkitpy/port/server_process.py (233833 => 233834)


--- trunk/Tools/Scripts/webkitpy/port/server_process.py	2018-07-14 02:15:49 UTC (rev 233833)
+++ trunk/Tools/Scripts/webkitpy/port/server_process.py	2018-07-14 06:48:09 UTC (rev 233834)
@@ -295,10 +295,9 @@
         # See http://code.activestate.com/recipes/440554-module-to-allow-asynchronous-subprocess-use-on-win/
         # and http://docs.activestate.com/activepython/2.6/pywin32/modules.html
         # for documentation on all of these win32-specific modules.
-        now = time.time()
         out_fh = msvcrt.get_osfhandle(self._proc.stdout.fileno())
         err_fh = msvcrt.get_osfhandle(self._proc.stderr.fileno())
-        while (self._proc.poll() is None) and (now < deadline):
+        while time.time() < deadline:
             output = self._non_blocking_read_win32(out_fh)
             error = self._non_blocking_read_win32(err_fh)
             if output or error:
@@ -307,9 +306,9 @@
                 if error:
                     self._error += error
                 return
+            if self._proc.poll() is not None:
+                return
             time.sleep(0.01)
-            now = time.time()
-        return
 
     def _non_blocking_read_win32(self, handle):
         try:

Modified: trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py (233833 => 233834)


--- trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py	2018-07-14 02:15:49 UTC (rev 233833)
+++ trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py	2018-07-14 06:48:09 UTC (rev 233834)
@@ -127,6 +127,24 @@
         proc.write('End\n')
         proc.stop(0)
 
+    def test_read_after_process_exits(self):
+        cmd = [sys.executable, '-c', 'import sys; print "stdout"; print >>sys.stderr, "stderr";']
+        host = SystemHost()
+        factory = PortFactory(host)
+        port = factory.get()
+        now = time.time()
+        proc = server_process.ServerProcess(port, 'python', cmd)
+        proc.write('')
+        time.sleep(0.1)  # Give process a moment to close.
+
+        line = proc.read_stdout_line(now + 1.0)
+        self.assertEqual(line.strip(), "stdout")
+
+        line = proc.read_stderr_line(now + 1.0)
+        self.assertEqual(line.strip(), "stderr")
+
+        proc.stop(0)
+
     def test_process_crashing(self):
         cmd = [sys.executable, '-c', 'import sys; print "stdout 1"; print "stdout 2"; print "stdout 3"; sys.stdout.flush(); sys.stdin.readline(); sys.exit(1);']
         host = SystemHost()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to