Changeset 69638 in webkit


Ignore:
Timestamp:
Oct 12, 2010 9:39:56 PM (14 years ago)
Author:
dpranke@chromium.org
Message:

2010-10-12 Dirk Pranke <dpranke@chromium.org>

Reviewed by Eric Seidel.

This patch enables new-run-webkit-tests (in particular the
chromium-win port) to run under Cygwin as well as Win32. Mostly
this just required some conversions from cygwin paths to Win32
paths when we spawn off Win32 binaries like test_shell.

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

  • Scripts/webkitpy/common/system/path.py:
  • Expose the cygpath() function for path conversion
  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:
  • Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
  • shift filename->uri conversion in the TestInfo objects to the dump_render_tree thread
  • Scripts/webkitpy/layout_tests/port/base.py:
  • Scripts/webkitpy/layout_tests/port/chromium.py:
  • use cygpath()
Location:
trunk/WebKitTools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r69637 r69638  
     12010-10-12  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        This patch enables new-run-webkit-tests (in particular the
     6        chromium-win port) to run under Cygwin as well as Win32. Mostly
     7        this just required some conversions from cygwin paths to Win32
     8        paths when we spawn off Win32 binaries like test_shell.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=47220
     11
     12        * Scripts/webkitpy/common/system/path.py:
     13        - Expose the cygpath() function for path conversion
     14
     15        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     16        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
     17        - shift filename->uri conversion in the TestInfo objects to the
     18          dump_render_tree thread
     19
     20        * Scripts/webkitpy/layout_tests/port/base.py:
     21        * Scripts/webkitpy/layout_tests/port/chromium.py:
     22        - use cygpath()
     23
    1242010-10-12  Yuta Kitamura  <yutak@chromium.org>
    225
  • trunk/WebKitTools/Scripts/webkitpy/common/system/path.py

    r69363 r69638  
    3939
    4040
     41def cygpath(path, executive):
     42    """Converts a cygwin path to Windows path."""
     43    # FIXME: this may not be correct in every situation, but forking
     44    # cygpath is very slow. More importantly, there is a bug in Python
     45    # where launching subprocesses and communicating with PIPEs (which
     46    # is what run_command() does) can lead to deadlocks when running in
     47    # multiple threads.
     48    if path.startswith("/cygdrive"):
     49        path = path[10] + ":" + path[11:]
     50        path = path.replace("/", "\\")
     51        return path
     52    return executive.run_command(['cygpath', '-wa', path],
     53                                 decode_output=False).rstrip()
     54
     55
    4156def _escape(path):
    4257    """Handle any characters in the path that should be escaped."""
     
    5368        return _winpath_to_uri(path)
    5469    if platform == 'cygwin':
    55         return _winpath_to_uri(_cygpath(path, executive))
     70        return _winpath_to_uri(cygpath(path, executive))
    5671    return _unixypath_to_uri(path)
    5772
     
    6176    return "///" + path.replace("\\", "/")
    6277
    63 
    64 def _cygpath(path, executive):
    65     """Converts a cygwin path to Windows path."""
    66     return executive.run_command(['cygpath', '-wa', path],
    67                                  decode_output=False).rstrip()
    68 
    69 
    7078def _unixypath_to_uri(path):
    7179    """Converts a unix-style path to a file: URL."""
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py

    r69578 r69638  
    8484      options: command line options argument from optparse
    8585      proc: an active DumpRenderTree process
    86       test_info: Object containing the test filename, uri and timeout
     86      test_info: Object containing the test filename and timeout
    8787      test_types: list of test types to subject the output to
    8888      test_args: arguments to be passed to each test
     
    173173          port: object implementing port-specific hooks
    174174          options: command line argument object from optparse
    175           test_info: Object containing the test filename, uri and timeout
     175          test_info: Object containing the test filename and timeout
    176176          test_types: A list of TestType objects to run the test output
    177177              against.
     
    194194        # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85.
    195195        test_info = self._test_info
     196        uri = self._port.filename_to_uri(test_info.filename)
    196197        self._driver = self._port.create_driver(self._test_args.png_path,
    197198                                                self._options)
     
    199200        start = time.time()
    200201        crash, timeout, actual_checksum, output, error = \
    201             self._driver.run_test(test_info.uri.strip(), test_info.timeout,
     202            self._driver.run_test(uri, test_info.timeout,
    202203                                  test_info.image_hash())
    203204        end = time.time()
     
    256257          options: command line options argument from optparse
    257258          filename_list_queue: A thread safe Queue class that contains lists
    258               of tuples of (filename, uri) pairs.
     259              of (filename, TestInfo) pairs.
    259260          result_queue: A thread safe Queue class that will contain tuples of
    260261              (test, failure lists) for the test results.
     
    460461
    461462        Args:
    462           test_info: Object containing the test filename, uri and timeout
     463          test_info: Object containing the test filename and timeout
    463464
    464465        Returns:
     
    508509
    509510        Args:
    510           test_info: Object containing the test filename, uri and timeout
     511          test_info: Object containing the test filename and timeout
    511512
    512513        Returns:
     
    530531        self._next_timeout = start + thread_timeout
    531532
     533        uri = self._port.filename_to_uri(test_info.filename)
    532534        crash, timeout, actual_checksum, output, error = \
    533            self._driver.run_test(test_info.uri, test_info.timeout, image_hash)
     535           self._driver.run_test(uri, test_info.timeout, image_hash)
    534536        end = time.time()
    535537
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py

    r69578 r69638  
    5050from webkitpy.common.system import logutils
    5151from webkitpy.common.system.executive import Executive, ScriptError
     52from webkitpy.common.system.path import abspath_to_uri
    5253from webkitpy.common.system.user import User
    5354
     
    313314            return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)
    314315
    315         abspath = os.path.abspath(filename)
    316 
    317         # On Windows, absolute paths are of the form "c:\foo.txt". However,
    318         # all current browsers (except for Opera) normalize file URLs by
    319         # prepending an additional "/" as if the absolute path was
    320         # "/c:/foo.txt". This means that all file URLs end up with "file:///"
    321         # at the beginning.
    322         if sys.platform == 'win32':
    323             abspath = '/' + abspath.replace('\\', '/')
    324 
    325         return "file://" + abspath
     316        return abspath_to_uri(os.path.abspath(filename), self._executive)
    326317
    327318    def tests(self, paths):
     
    372363        test = uri
    373364        if uri.startswith("file:///"):
     365            # FIXME: need an inverse of uri_to_abspath()
    374366            if sys.platform == 'win32':
    375367                test = test.replace('file:///', '')
    376368                test = test.replace('/', '\\')
     369            elif sys.platform == 'cygwin':
     370                test = '/cygdrive/' + uri[8] + '/' + uri[11:]
    377371            else:
    378372                test = test.replace('file://', '')
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py

    r69065 r69638  
    3535
    3636from webkitpy.common.system.executive import Executive, ScriptError
     37from webkitpy.common.system.path import abspath_to_uri
    3738from webkitpy.thirdparty.mock import Mock
    3839
     
    228229
    229230    def test_filename_to_uri(self):
    230 
    231231        port = base.Port()
    232232        layout_test_dir = port.layout_tests_dir()
    233233        test_file = os.path.join(layout_test_dir, "foo", "bar.html")
    234 
    235         # On Windows, absolute paths are of the form "c:\foo.txt". However,
    236         # all current browsers (except for Opera) normalize file URLs by
    237         # prepending an additional "/" as if the absolute path was
    238         # "/c:/foo.txt". This means that all file URLs end up with "file:///"
    239         # at the beginning.
    240         if sys.platform == 'win32':
    241             prefix = "file:///"
    242             path = test_file.replace("\\", "/")
    243         else:
    244             prefix = "file://"
    245             path = test_file
    246 
    247234        self.assertEqual(port.filename_to_uri(test_file),
    248                          prefix + path)
     235                         abspath_to_uri(test_file, Executive()))
    249236
    250237
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py

    r69160 r69638  
    4444import webbrowser
    4545
     46from webkitpy.common.system.executive import Executive
     47from webkitpy.common.system.path import abspath_to_uri, cygpath
     48from webkitpy.layout_tests.layout_package import test_expectations
     49
    4650import base
    4751import http_server
    48 
    49 from webkitpy.common.system.executive import Executive
    50 from webkitpy.layout_tests.layout_package import test_expectations
    5152
    5253# Chromium DRT on OSX uses WebKitDriver.
     
    144145            file.write(actual_contents)
    145146
     147        # We use convert_path if there's a chance that the launched
     148        # executable needs filename arguments in a different format than
     149        # the normal format provided by the python runtime. The main
     150        # example of this is running under Cygwin on Windows but
     151        # launching a Win32 binary, where we need to convert the path
     152        # from /cygdrive/c/foo.txt to c:\foo.txt.
    146153        if diff_filename:
    147             cmd = [executable, '--diff', expected_filename,
    148                    actual_filename, diff_filename]
     154            cmd = [executable, '--diff',
     155                   self._convert_path(expected_filename),
     156                   self._convert_path(actual_filename),
     157                   self._convert_path(diff_filename)]
    149158        else:
    150             cmd = [executable, expected_filename, actual_filename]
     159            cmd = [executable,
     160                   self._convert_path(expected_filename),
     161                   self._convert_path(actual_filename)]
    151162
    152163        result = True
     
    341352        return self.path_from_webkit_base('LayoutTests', 'platform', platform)
    342353
     354    def _convert_path(self, path):
     355        """Handles filename conversion for subprocess command line args."""
     356        # See note above in diff_image() for why we need this.
     357        if sys.platform == 'cygwin':
     358            return cygpath(path, self._executive)
     359        return path
     360
    343361    def _path_to_image_diff(self):
    344362        binary_name = 'image_diff'
     
    360378        driver_args = []
    361379        if self._image_path:
    362             driver_args.append("--pixel-tests=" + self._image_path)
     380            # See note above in diff_image() for why we need
     381            # _convert_path().
     382            driver_args.append("--pixel-tests=" +
     383                               self._port._convert_path(self._image_path))
    363384
    364385        if self._options.use_drt:
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r69578 r69638  
    9292
    9393    def __init__(self, port, filename, timeout):
    94         """Generates the URI and stores the filename and timeout for this test.
     94        """
    9595        Args:
    9696          filename: Full path to the test.
    97           timeout: Timeout for running the test in TestShell.
     97          timeout: Timeout for running the test in DRT.
    9898          """
    9999        self.filename = filename
    100100        self._port = port
    101         self.uri = port.filename_to_uri(filename)
    102101        self.timeout = timeout
    103102        self._image_checksum = -1
Note: See TracChangeset for help on using the changeset viewer.