Changeset 84111 in webkit


Ignore:
Timestamp:
Apr 17, 2011 2:48:01 PM (13 years ago)
Author:
dpranke@chromium.org
Message:

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

Reviewed by Ojan Vafai.

new-run-webkit-tests: read stderr from chromium DRT separately
https://bugs.webkit.org/show_bug.cgi?id=58708

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

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r84104 r84111  
     12011-04-17  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        new-run-webkit-tests: read stderr from chromium DRT separately
     6        https://bugs.webkit.org/show_bug.cgi?id=58708
     7
     8        * Scripts/webkitpy/layout_tests/port/chromium.py:
     9        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
     10        * Scripts/webkitpy/layout_tests/port/mock_drt.py:
     11
    1122011-04-17  Patrick Gansterer  <paroga@webkit.org>
    213
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py

    r83759 r84111  
    358358            self._image_path = self._port._filesystem.join(self._port.results_directory(),
    359359                'png_result%s.png' % self._worker_number)
     360        self._stderr_is_nonblocking = False
    360361
    361362    def cmd_line(self):
     
    404405        self._proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,
    405406                                      stdout=subprocess.PIPE,
    406                                       stderr=subprocess.STDOUT,
     407                                      stderr=subprocess.PIPE,
    407408                                      close_fds=close_flag)
     409        self._stderr_is_nonblocking = False
    408410
    409411    def poll(self):
     
    516518                output.append(line)
    517519            else:
    518                 error.append(line)
     520                error.append('extra stdout output: %s' % line)
    519521
    520522            (line, crash) = self._write_command_and_read_line(input=None)
     
    527529        if not text:
    528530            text = None
     531        error_text = ''.join(error) + self._read_stderr()
    529532
    530533        return base.DriverOutput(text, output_image, actual_checksum, audio=None,
    531             crash=crash, test_time=run_time, timeout=timeout, error=''.join(error))
     534            crash=crash, test_time=run_time, timeout=timeout, error=error_text)
    532535
    533536    def stop(self):
     
    553556                self._proc.wait()
    554557            self._proc = None
     558
     559    def _read_stderr(self):
     560        if sys.platform in ('win32', 'cygwin'):
     561            import msvcrt
     562            import win32pipe
     563
     564            fd = self._proc.stderr.fileno()
     565            osf = msvcrt.get_osfhandle(fd)
     566            _, avail, _ = win32pipe.PeekNamedPipe(osf, 0)
     567            if avail:
     568                return self._proc.stderr.read(avail)
     569            return ''
     570        else:
     571            if not self._stderr_is_nonblocking:
     572                import fcntl
     573                import os
     574                fd = self._proc.stderr.fileno()
     575                fl = fcntl.fcntl(fd, fcntl.F_GETFL)
     576                fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
     577                self._stderr_is_nonblocking = True
     578            return self._proc.stderr.read()
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py

    r83476 r84111  
    4242import chromium_win
    4343
     44from webkitpy.layout_tests.port import base
     45from webkitpy.layout_tests.port import factory
    4446from webkitpy.layout_tests.port import port_testcase
    4547
     
    221223        self.assertFalse(exception_raised)
    222224
     225    # Disabled because this is an integration test that relies on the
     226    # actual filesystem.
     227    def disabled_test_stderr(self):
     228        port = factory.get('mock-chromium-mac-snowleopard')
     229        path = port.abspath_for_test('fast/html/article-element.html')
     230        self.assertTrue(port._filesystem.exists(path))
     231
     232        driver = port.create_driver(1)
     233        driver.start()
     234        try:
     235            driver_input = base.DriverInput(path, 1000, None)
     236            driver_output = driver.run_test(driver_input)
     237            self.assertEquals(driver_output.error.strip(), 'stuff going to stderr')
     238        finally:
     239            driver.stop()
     240
    223241
    224242class ChromiumPortLoggingTest(logtesting.LoggingTestCase):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py

    r83475 r84111  
    284284        self._stdout.flush()
    285285
     286        # FIXME: this is a lame hack to test that we are capturing stderr
     287        # output correctly. We should fix this by passing in a command line
     288        # arg once https://bugs.webkit.org/show_bug.cgi?id=58680 lands.
     289        if 'article-element' in test_input.uri:
     290            self._stderr.write("stuff going to stderr\n")
     291            self._stderr.flush()
     292
    286293
    287294if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.