[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dpranke at chromium.org dpranke at chromium.org
Thu Apr 8 02:05:58 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit fe049d3531962e5725a63d771a49900cf21f1f70
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 2 01:07:09 2010 +0000

    2010-03-01  Dirk Pranke  <dpranke at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Work around a bug in Python's subprocess.Popen() that keeps us from
            cleaning up DumpRenderTree / test_shell properly when we finish the
            tests in new-run-webkit-tests.
    
            https://bugs.webkit.org/show_bug.cgi?id=35553
    
            * Scripts/webkitpy/layout_tests/port/chromium.py:
            * Scripts/webkitpy/layout_tests/port/mac.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f3314c3..6657993 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-01  Dirk Pranke  <dpranke at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Work around a bug in Python's subprocess.Popen() that keeps us from
+        cleaning up DumpRenderTree / test_shell properly when we finish the
+        tests in new-run-webkit-tests.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35553
+
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+
 2010-03-01  Arno Renevier  <arno at renevier.net>
 
         Reviewed by Xan Lopez.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index 8748c89..f57fa74 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -227,10 +227,14 @@ class ChromiumDriver(base.Driver):
         cmd += [port._path_to_driver(), '--layout-tests']
         if options:
             cmd += options
+
+        # We need to pass close_fds=True to work around Python bug #2320
+        # (otherwise we can hang when we kill test_shell when we are running
+        # multiple threads). See http://bugs.python.org/issue2320 .
         self._proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                                       stdout=subprocess.PIPE,
-                                      stderr=subprocess.STDOUT)
-
+                                      stderr=subprocess.STDOUT,
+                                      close_fds=True)
     def poll(self):
         return self._proc.poll()
 
@@ -299,10 +303,20 @@ class ChromiumDriver(base.Driver):
             self._proc.stdout.close()
             if self._proc.stderr:
                 self._proc.stderr.close()
-            if (sys.platform not in ('win32', 'cygwin') and
-                not self._proc.poll()):
-                # Closing stdin/stdout/stderr hangs sometimes on OS X.
-                null = open(os.devnull, "w")
-                subprocess.Popen(["kill", "-9",
-                                 str(self._proc.pid)], stderr=null)
-                null.close()
+            if sys.platform not in ('win32', 'cygwin'):
+                # Closing stdin/stdout/stderr hangs sometimes on OS X,
+                # (see __init__(), above), and anyway we don't want to hang
+                # the harness if test_shell is buggy, so we wait a couple
+                # seconds to give test_shell a chance to clean up, but then
+                # force-kill the process if necessary.
+                KILL_TIMEOUT = 3.0
+                timeout = time.time() + KILL_TIMEOUT
+                while self._proc.poll() is None and time.time() < timeout:
+                    time.sleep(0.1)
+                if self._proc.poll() is None:
+                    logging.warning('stopping test driver timed out, '
+                                    'killing it')
+                    null = open(os.devnull, "w")
+                    subprocess.Popen(["kill", "-9",
+                                     str(self._proc.pid)], stderr=null)
+                    null.close()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
index c51a92b..96ea00c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -321,10 +321,14 @@ class MacDriver(base.Driver):
 
     def restart(self):
         self.stop()
+        # We need to pass close_fds=True to work around Python bug #2320
+        # (otherwise we can hang when we kill test_shell when we are running
+        # multiple threads). See http://bugs.python.org/issue2320 .
         self._proc = subprocess.Popen(self._cmd, stdin=subprocess.PIPE,
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE,
-                                      env=self._env)
+                                      env=self._env,
+                                      close_fds=True)
 
     def returncode(self):
         return self._proc.returncode
@@ -425,13 +429,23 @@ class MacDriver(base.Driver):
             self._proc.stdout.close()
             if self._proc.stderr:
                 self._proc.stderr.close()
-            if (sys.platform not in ('win32', 'cygwin') and
-                not self._proc.poll()):
-                # Closing stdin/stdout/stderr hangs sometimes on OS X.
-                null = open(os.devnull, "w")
-                subprocess.Popen(["kill", "-9",
-                                 str(self._proc.pid)], stderr=null)
-                null.close()
+            if sys.platform not in ('win32', 'cygwin'):
+                # Closing stdin/stdout/stderr hangs sometimes on OS X,
+                # (see restart(), above), and anyway we don't want to hang
+                # the harness if test_shell is buggy, so we wait a couple
+                # seconds to give test_shell a chance to clean up, but then
+                # force-kill the process if necessary.
+                KILL_TIMEOUT = 3.0
+                timeout = time.time() + KILL_TIMEOUT
+                while self._proc.poll() is None and time.time() < timeout:
+                    time.sleep(0.1)
+                if self._proc.poll() is None:
+                    logging.warning('stopping test driver timed out, '
+                                    'killing it')
+                    null = open(os.devnull, "w")
+                    subprocess.Popen(["kill", "-9",
+                                     str(self._proc.pid)], stderr=null)
+                    null.close()                not self._proc.poll()):
 
     def _read_line(self, timeout, stop_time, image_length=0):
         now = time.time()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list