Changeset 55388 in webkit


Ignore:
Timestamp:
Mar 1, 2010 5:07:09 PM (14 years ago)
Author:
dpranke@chromium.org
Message:

2010-03-01 Dirk Pranke <dpranke@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:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r55384 r55388  
     12010-03-01  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Work around a bug in Python's subprocess.Popen() that keeps us from
     6        cleaning up DumpRenderTree / test_shell properly when we finish the
     7        tests in new-run-webkit-tests.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=35553
     10
     11        * Scripts/webkitpy/layout_tests/port/chromium.py:
     12        * Scripts/webkitpy/layout_tests/port/mac.py:
     13
    1142010-03-01  Arno Renevier  <arno@renevier.net>
    215
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py

    r55382 r55388  
    228228        if options:
    229229            cmd += options
     230
     231        # We need to pass close_fds=True to work around Python bug #2320
     232        # (otherwise we can hang when we kill test_shell when we are running
     233        # multiple threads). See http://bugs.python.org/issue2320 .
    230234        self._proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
    231235                                      stdout=subprocess.PIPE,
    232                                       stderr=subprocess.STDOUT)
    233 
     236                                      stderr=subprocess.STDOUT,
     237                                      close_fds=True)
    234238    def poll(self):
    235239        return self._proc.poll()
     
    300304            if self._proc.stderr:
    301305                self._proc.stderr.close()
    302             if (sys.platform not in ('win32', 'cygwin') and
    303                 not self._proc.poll()):
    304                 # Closing stdin/stdout/stderr hangs sometimes on OS X.
    305                 null = open(os.devnull, "w")
    306                 subprocess.Popen(["kill", "-9",
    307                                  str(self._proc.pid)], stderr=null)
    308                 null.close()
     306            if sys.platform not in ('win32', 'cygwin'):
     307                # Closing stdin/stdout/stderr hangs sometimes on OS X,
     308                # (see __init__(), above), and anyway we don't want to hang
     309                # the harness if test_shell is buggy, so we wait a couple
     310                # seconds to give test_shell a chance to clean up, but then
     311                # force-kill the process if necessary.
     312                KILL_TIMEOUT = 3.0
     313                timeout = time.time() + KILL_TIMEOUT
     314                while self._proc.poll() is None and time.time() < timeout:
     315                    time.sleep(0.1)
     316                if self._proc.poll() is None:
     317                    logging.warning('stopping test driver timed out, '
     318                                    'killing it')
     319                    null = open(os.devnull, "w")
     320                    subprocess.Popen(["kill", "-9",
     321                                     str(self._proc.pid)], stderr=null)
     322                    null.close()
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py

    r55373 r55388  
    322322    def restart(self):
    323323        self.stop()
     324        # We need to pass close_fds=True to work around Python bug #2320
     325        # (otherwise we can hang when we kill test_shell when we are running
     326        # multiple threads). See http://bugs.python.org/issue2320 .
    324327        self._proc = subprocess.Popen(self._cmd, stdin=subprocess.PIPE,
    325328                                      stdout=subprocess.PIPE,
    326329                                      stderr=subprocess.PIPE,
    327                                       env=self._env)
     330                                      env=self._env,
     331                                      close_fds=True)
    328332
    329333    def returncode(self):
     
    426430            if self._proc.stderr:
    427431                self._proc.stderr.close()
    428             if (sys.platform not in ('win32', 'cygwin') and
    429                 not self._proc.poll()):
    430                 # Closing stdin/stdout/stderr hangs sometimes on OS X.
    431                 null = open(os.devnull, "w")
    432                 subprocess.Popen(["kill", "-9",
    433                                  str(self._proc.pid)], stderr=null)
    434                 null.close()
     432            if sys.platform not in ('win32', 'cygwin'):
     433                # Closing stdin/stdout/stderr hangs sometimes on OS X,
     434                # (see restart(), above), and anyway we don't want to hang
     435                # the harness if test_shell is buggy, so we wait a couple
     436                # seconds to give test_shell a chance to clean up, but then
     437                # force-kill the process if necessary.
     438                KILL_TIMEOUT = 3.0
     439                timeout = time.time() + KILL_TIMEOUT
     440                while self._proc.poll() is None and time.time() < timeout:
     441                    time.sleep(0.1)
     442                if self._proc.poll() is None:
     443                    logging.warning('stopping test driver timed out, '
     444                                    'killing it')
     445                    null = open(os.devnull, "w")
     446                    subprocess.Popen(["kill", "-9",
     447                                     str(self._proc.pid)], stderr=null)
     448                    null.close()                not self._proc.poll()):
    435449
    436450    def _read_line(self, timeout, stop_time, image_length=0):
Note: See TracChangeset for help on using the changeset viewer.