2011-01-28 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jan 2011 01:41:51 +0000 (01:41 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jan 2011 01:41:51 +0000 (01:41 +0000)
        Unreviewed, build fix.

        Take two. The fix in 77023 didn't work, because we were
        still calling path.abspath_to_uri, which calls _cygpath under
        the covers, and it appears the cygpath on the bots does
        something different than it does on my machine. This patch
        removes the calls to path.abspath_to_uri, so it should be safe.
        If it doesn't work, I'll roll it out along with r76982 and 77023.

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

        * Scripts/webkitpy/layout_tests/port/test.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77038 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/port/test.py

index 9c2367077aacd2e80d0001be9c11f327fbfb0173..aa93a580a6e47044e46fea8b2bbd8afe397552ef 100644 (file)
@@ -1,3 +1,18 @@
+2011-01-28  Dirk Pranke  <dpranke@chromium.org>
+
+        Unreviewed, build fix.
+
+        Take two. The fix in 77023 didn't work, because we were
+        still calling path.abspath_to_uri, which calls _cygpath under
+        the covers, and it appears the cygpath on the bots does
+        something different than it does on my machine. This patch
+        removes the calls to path.abspath_to_uri, so it should be safe.
+        If it doesn't work, I'll roll it out along with r76982 and 77023.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53126
+
+        * Scripts/webkitpy/layout_tests/port/test.py:
+
 2011-01-28  David Kilzer  <ddkilzer@apple.com>
 
         <rdar://problem/8930699> build-webkit gives a bogus warning with newer versions of Xcode 
index 577fe57dd774fb9178340756cb64eb6d55fe0c32..66618a52ba4cce892f2f15cf70b2b576fdf79d44 100644 (file)
@@ -283,6 +283,65 @@ class TestPort(base.Port):
         }
         return name_map[test_platform_name]
 
+    # FIXME: These next two routines are copied from base.py with
+    # the calls to path.abspath_to_uri() removed. We shouldn't have
+    # to do this.
+    def filename_to_uri(self, filename):
+        """Convert a test file (which is an absolute path) to a URI."""
+        LAYOUTTEST_HTTP_DIR = "http/tests/"
+        LAYOUTTEST_WEBSOCKET_DIR = "http/tests/websocket/tests/"
+
+        relative_path = self.relative_test_filename(filename)
+        port = None
+        use_ssl = False
+
+        if (relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR)
+            or relative_path.startswith(LAYOUTTEST_HTTP_DIR)):
+            relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):]
+            port = 8000
+
+        # Make http/tests/local run as local files. This is to mimic the
+        # logic in run-webkit-tests.
+        #
+        # TODO(dpranke): remove the media reference and the SSL reference?
+        if (port and not relative_path.startswith("local/") and
+            not relative_path.startswith("media/")):
+            if relative_path.startswith("ssl/"):
+                port += 443
+                protocol = "https"
+            else:
+                protocol = "http"
+            return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)
+
+        return "file://" + self._filesystem.abspath(filename)
+
+    def uri_to_test_name(self, uri):
+        """Return the base layout test name for a given URI.
+
+        This returns the test name for a given URI, e.g., if you passed in
+        "file:///src/LayoutTests/fast/html/keygen.html" it would return
+        "fast/html/keygen.html".
+
+        """
+        test = uri
+        if uri.startswith("file:///"):
+            prefix = "file://" + self.layout_tests_dir() + "/"
+            return test[len(prefix):]
+
+        if uri.startswith("http://127.0.0.1:8880/"):
+            # websocket tests
+            return test.replace('http://127.0.0.1:8880/', '')
+
+        if uri.startswith("http://"):
+            # regular HTTP test
+            return test.replace('http://127.0.0.1:8000/', 'http/tests/')
+
+        if uri.startswith("https://"):
+            return test.replace('https://127.0.0.1:8443/', 'http/tests/')
+
+        raise NotImplementedError('unknown url type: %s' % uri)
+
+
     def version(self):
         return ''