Changeset 83384 in webkit


Ignore:
Timestamp:
Apr 9, 2011 5:30:54 PM (13 years ago)
Author:
dpranke@chromium.org
Message:

2011-04-09 Dirk Pranke <dpranke@chromium.org>

Reviewed by Tony Chang.

It looks like NRWT has not been stopping DRT/TestShell
instances properly on windows, probably for a long time.
This would go a long way to explaining why we often have
processes lying around :)

https://bugs.webkit.org/show_bug.cgi?id=57807

  • Scripts/webkitpy/layout_tests/port/chromium.py:
  • Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r83380 r83384  
     12011-04-09  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        It looks like NRWT has not been stopping DRT/TestShell
     6        instances properly on windows, probably for a long time.
     7        This would go a long way to explaining why we often have
     8        processes lying around :)
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=57807
     11
     12        * Scripts/webkitpy/layout_tests/port/chromium.py:
     13        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
     14
    1152011-04-09  Keith Kyzivat  <keith.kyzivat@nokia.com>
    216
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py

    r83361 r83384  
    335335        self._worker_number = worker_number
    336336        self._image_path = None
     337        self.KILL_TIMEOUT = 3.0
    337338        if self._port.get_option('pixel_tests'):
    338339            self._image_path = self._port._filesystem.join(
     
    513514            if self._proc.stderr:
    514515                self._proc.stderr.close()
    515             if sys.platform not in ('win32', 'cygwin'):
    516                 # Closing stdin/stdout/stderr hangs sometimes on OS X,
    517                 # (see __init__(), above), and anyway we don't want to hang
    518                 # the harness if DRT is buggy, so we wait a couple
    519                 # seconds to give DRT a chance to clean up, but then
    520                 # force-kill the process if necessary.
    521                 KILL_TIMEOUT = 3.0
    522                 timeout = time.time() + KILL_TIMEOUT
    523                 # poll() is not threadsafe and can throw OSError due to:
    524                 # http://bugs.python.org/issue1731717
    525                 while self._proc.poll() is None and time.time() < timeout:
    526                     time.sleep(0.1)
    527                 # poll() is not threadsafe and can throw OSError due to:
    528                 # http://bugs.python.org/issue1731717
    529                 if self._proc.poll() is None:
    530                     _log.warning('stopping test driver timed out, '
    531                                  'killing it')
    532                     self._port._executive.kill_process(self._proc.pid)
     516            # Closing stdin/stdout/stderr hangs sometimes on OS X,
     517            # (see __init__(), above), and anyway we don't want to hang
     518            # the harness if DRT is buggy, so we wait a couple
     519            # seconds to give DRT a chance to clean up, but then
     520            # force-kill the process if necessary.
     521            timeout = time.time() + self.KILL_TIMEOUT
     522            while self._proc.poll() is None and time.time() < timeout:
     523                time.sleep(0.1)
     524            if self._proc.poll() is None:
     525                _log.warning('stopping test driver timed out, '
     526                                'killing it')
     527                self._port._executive.kill_process(self._proc.pid)
     528            assert self._proc.poll() is not None
     529            self._proc.wait()
     530            self._proc = None
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py

    r79176 r83384  
    8686        self._assert_write_command_and_read_line(expected_crash=True)
    8787
     88    def test_stop(self):
     89        self.pid = None
     90        self.wait_called = False
     91        self.driver._proc = Mock()
     92        self.driver._proc.pid = 1
     93        self.driver._proc.stdin = StringIO.StringIO()
     94        self.driver._proc.stdout = StringIO.StringIO()
     95        self.driver._proc.stderr = StringIO.StringIO()
     96        self.driver._proc.poll = lambda: None
     97
     98        def fake_wait():
     99            self.assertTrue(self.pid is not None)
     100            self.wait_called = True
     101
     102        self.driver._proc.wait = fake_wait
     103
     104        class FakeExecutive(object):
     105            def kill_process(other, pid):
     106                self.pid = pid
     107                self.driver._proc.poll = lambda: 2
     108
     109        self.driver._port._executive = FakeExecutive()
     110        self.driver.KILL_TIMEOUT = 0.01
     111        self.driver.stop()
     112        self.assertTrue(self.wait_called)
     113        self.assertEquals(self.pid, 1)
    88114
    89115class ChromiumPortTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.