Changeset 69065 in webkit


Ignore:
Timestamp:
Oct 4, 2010 9:19:16 PM (14 years ago)
Author:
dpranke@chromium.org
Message:

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

Reviewed by Adam Barth.

aroben's change in r68792 actually broke new-run-webkit-tests when
running the DRT code path. His change was intended to fix the
way we were converting windows paths to URIs when running under
Cygwin (the paths were getting one too many "/" on the front).
However, the change ended up breaking the chromium_win port, which
had slightly different logic.

This patch removes the port-specific code and adds tests to make
sure we're getting the behavior we expect. The Port object no longer
exposes a get_absolute_path() method that can be used outside of
of converting test filenames, because it's unreliable otherwise
(we don't have the right context to know which conversion is intended).

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

  • Scripts/webkitpy/layout_tests/port/base.py:
  • Scripts/webkitpy/layout_tests/port/base_unittest.py:
  • Scripts/webkitpy/layout_tests/port/chromium_win.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
Location:
trunk/WebKitTools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r69050 r69065  
     12010-10-04  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        aroben's change in r68792 actually broke new-run-webkit-tests when
     6        running the DRT code path. His change was intended to fix the
     7        way we were converting windows paths to URIs when running under
     8        Cygwin (the paths were getting one too many "/" on the front).
     9        However, the change ended up breaking the chromium_win port, which
     10        had slightly different logic.
     11
     12        This patch removes the port-specific code and adds tests to make
     13        sure we're getting the behavior we expect. The Port object no longer
     14        exposes a get_absolute_path() method that can be used outside of
     15        of converting test filenames, because it's unreliable otherwise
     16        (we don't have the right context to know which conversion is intended).
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=47140
     19
     20        * Scripts/webkitpy/layout_tests/port/base.py:
     21        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
     22        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
     23        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     24        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
     25
    1262010-10-04  Dirk Pranke  <dpranke@chromium.org>
    227
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py

    r68914 r69065  
    282282
    283283    def filename_to_uri(self, filename):
    284         """Convert a test file to a URI."""
     284        """Convert a test file (which is an absolute path) to a URI."""
    285285        LAYOUTTEST_HTTP_DIR = "http/tests/"
    286286        LAYOUTTEST_WEBSOCKET_DIR = "http/tests/websocket/tests/"
     
    308308            return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)
    309309
    310         if sys.platform is 'win32':
    311             return "file:///" + self.get_absolute_path(filename)
    312         return "file://" + self.get_absolute_path(filename)
     310        abspath = os.path.abspath(filename)
     311
     312        # On Windows, absolute paths are of the form "c:\foo.txt". However,
     313        # all current browsers (except for Opera) normalize file URLs by
     314        # prepending an additional "/" as if the absolute path was
     315        # "/c:/foo.txt". This means that all file URLs end up with "file:///"
     316        # at the beginning.
     317        if sys.platform == 'win32':
     318            abspath = '/' + abspath.replace('\\', '/')
     319
     320        return "file://" + abspath
    313321
    314322    def tests(self, paths):
     
    378386
    379387        raise NotImplementedError('unknown url type: %s' % uri)
    380 
    381     def get_absolute_path(self, filename):
    382         """Return the absolute path in unix format for the given filename.
    383 
    384         This routine exists so that platforms that don't use unix filenames
    385         can convert accordingly."""
    386         return os.path.abspath(filename)
    387388
    388389    def layout_tests_dir(self):
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py

    r68365 r69065  
    227227        self.assertTrue('css2.1' in dirs)
    228228
     229    def test_filename_to_uri(self):
     230
     231        port = base.Port()
     232        layout_test_dir = port.layout_tests_dir()
     233        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
     247        self.assertEqual(port.filename_to_uri(test_file),
     248                         prefix + path)
     249
     250
     251
    229252class VirtualTest(unittest.TestCase):
    230253    """Tests that various methods expected to be virtual are."""
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py

    r68009 r69065  
    8484                       'build-instructions-windows')
    8585        return result
    86 
    87     def get_absolute_path(self, filename):
    88         """Return the absolute path in unix format for the given filename."""
    89         abspath = os.path.abspath(filename)
    90         return abspath.replace('\\', '/')
    9186
    9287    def relative_test_filename(self, filename):
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r68903 r69065  
    14401440        options.use_apache = sys.platform in ('darwin', 'linux2')
    14411441
    1442     if options.results_directory.startswith("/"):
    1443         # Assume it's an absolute path and normalize.
    1444         options.results_directory = port_obj.get_absolute_path(
    1445             options.results_directory)
    1446     else:
    1447         # If it's a relative path, make the output directory relative to
    1448         # Debug or Release.
     1442    if not os.path.isabs(options.results_directory):
     1443        # This normalizes the path to the build dir.
     1444        # FIXME: how this happens is not at all obvious; this is a dumb
     1445        # interface and should be cleaned up.
    14491446        options.results_directory = port_obj.results_directory()
    14501447
  • trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

    r68914 r69065  
    234234        self.assertEqual(user.url, '/tmp/layout-test-results/results.html')
    235235
     236    def test_results_directory_absolute(self):
     237        # We run a configuration that should fail, to generate output, then
     238        # look for what the output results url was.
     239
     240        res, out, err, user = logging_run(['--results-directory=/tmp-results'],
     241                                          tests_included=True)
     242        self.assertEqual(user.url, '/tmp-results/results.html')
     243
     244    def test_results_directory_default(self):
     245        # We run a configuration that should fail, to generate output, then
     246        # look for what the output results url was.
     247
     248        # This is the default location.
     249        res, out, err, user = logging_run(tests_included=True)
     250        self.assertEqual(user.url, '/tmp/layout-test-results/results.html')
     251
     252    def test_results_directory_relative(self):
     253        # We run a configuration that should fail, to generate output, then
     254        # look for what the output results url was.
     255
     256        res, out, err, user = logging_run(['--results-directory=foo'],
     257                                          tests_included=True)
     258        self.assertEqual(user.url, '/tmp/foo/results.html')
     259
     260
    236261
    237262def _mocked_open(original_open, file_list):
Note: See TracChangeset for help on using the changeset viewer.