run-webkit-tests: http server for imported W3C tests doesn't work with --layout-tests...
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2015 04:02:48 +0000 (04:02 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2015 04:02:48 +0000 (04:02 +0000)
<http://webkit.org/b/151542>

Reviewed by Daniel Bates.

* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(base_url): Use the Port object (already passed in) to give us
the path to the LayoutTests directory, which already checks for a
--layout-tests-directory command-line switch.
(WebPlatformTestServer.__init__): Remove layout_test_results_dir
argument since we can get this from the Port object already
passed in via Port.results_directory().  Also switch to use
Port.layout_tests_dir() to get the LayoutTests directory.

* Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
(TestWebPlatformTestServer.test_custom_layout_tests_directory):
Add test case for custom LayoutTests directory.
(TestWebPlatformTestServer.test_previously_spawned_instance):
Update Port object to set mock results directory as if it was
set on the command-line.  Remove unneeded argument from
WebPlatformTestServer constructor.
(TestWebPlatformTestServer.test_corrupted_subserver_files): Ditto.

* Scripts/webkitpy/port/base.py:
(Port.to.start_web_platform_test_server): Remove unneeded
argument from WebPlatformTestServer constuctor.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py
Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py
Tools/Scripts/webkitpy/port/base.py

index 4188fbc..d2db228 100644 (file)
@@ -1,3 +1,32 @@
+2015-11-22  David Kilzer  <ddkilzer@apple.com>
+
+        run-webkit-tests: http server for imported W3C tests doesn't work with --layout-tests-directory switch
+        <http://webkit.org/b/151542>
+
+        Reviewed by Daniel Bates.
+
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+        (base_url): Use the Port object (already passed in) to give us
+        the path to the LayoutTests directory, which already checks for a
+        --layout-tests-directory command-line switch.
+        (WebPlatformTestServer.__init__): Remove layout_test_results_dir
+        argument since we can get this from the Port object already
+        passed in via Port.results_directory().  Also switch to use
+        Port.layout_tests_dir() to get the LayoutTests directory.
+
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server_unittest.py:
+        (TestWebPlatformTestServer.test_custom_layout_tests_directory):
+        Add test case for custom LayoutTests directory.
+        (TestWebPlatformTestServer.test_previously_spawned_instance):
+        Update Port object to set mock results directory as if it was
+        set on the command-line.  Remove unneeded argument from
+        WebPlatformTestServer constructor.
+        (TestWebPlatformTestServer.test_corrupted_subserver_files): Ditto.
+
+        * Scripts/webkitpy/port/base.py:
+        (Port.to.start_web_platform_test_server): Remove unneeded
+        argument from WebPlatformTestServer constuctor.
+
 2015-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Some unit tests fail when using the network process
index 4bb2e4b..9e2547b 100755 (executable)
@@ -40,7 +40,7 @@ def doc_root(port_obj):
 
 
 def base_url(port_obj):
-    config_wk_filepath = port_obj.path_from_webkit_base("LayoutTests", "imported", "w3c", "resources", "config.json")
+    config_wk_filepath = port_obj._filesystem.join(port_obj.layout_tests_dir(), "imported", "w3c", "resources", "config.json")
     if not port_obj.host.filesystem.isfile(config_wk_filepath):
         # This should only be hit by webkitpy unit tests
         _log.debug("No WPT config file found")
@@ -52,9 +52,9 @@ def base_url(port_obj):
 
 
 class WebPlatformTestServer(http_server_base.HttpServerBase):
-    def __init__(self, port_obj, name, layout_test_results_dir, pidfile=None):
+    def __init__(self, port_obj, name, pidfile=None):
         http_server_base.HttpServerBase.__init__(self, port_obj)
-        self._output_dir = layout_test_results_dir
+        self._output_dir = port_obj.results_directory()
 
         self._name = name
         self._log_file_name = '%s_process_log.out.txt' % (self._name)
@@ -69,14 +69,14 @@ class WebPlatformTestServer(http_server_base.HttpServerBase):
         self._stdout_data = None
         self._stderr_data = None
         self._filesystem = port_obj.host.filesystem
-        self._layout_root = port_obj.path_from_webkit_base("LayoutTests")
+        self._layout_root = port_obj.layout_tests_dir()
         self._doc_root = self._filesystem.join(self._layout_root, doc_root(port_obj))
 
         self._resources_files_to_copy = ['testharness.css', 'testharnessreport.js']
 
         current_dir_path = self._filesystem.abspath(self._filesystem.split(__file__)[0])
         self._start_cmd = ["python", self._filesystem.join(current_dir_path, "web_platform_test_launcher.py"), self._servers_file]
-        self._doc_root_path = port_obj.path_from_webkit_base("LayoutTests", self._doc_root)
+        self._doc_root_path = self._filesystem.join(self._layout_root, self._doc_root)
 
     def _install_modules(self):
         modules_file_path = self._filesystem.join(self._doc_root_path, "..", "resources", "web-platform-tests-modules.json")
index 198ef5f..2059fd7 100644 (file)
@@ -22,6 +22,7 @@
 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import imp
+import optparse
 import sys
 import time
 import unittest
@@ -38,8 +39,10 @@ from webkitpy.layout_tests.servers.web_platform_test_server import WebPlatformTe
 class TestWebPlatformTestServer(unittest.TestCase):
     def test_previously_spawned_instance(self):
         host = MockHost()
-        port = Port(host, "test")
-        server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir", "/mock/output_dir/pid.txt")
+        options = optparse.Values()
+        options.ensure_value("results_directory", "/mock/output_dir")
+        port = Port(host, "test", options)
+        server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir/pid.txt")
         server._check_that_all_ports_are_available = lambda: True
         server._is_server_running_on_all_ports = lambda: True
         host.filesystem.write_text_file("/mock-checkout/LayoutTests/resources/testharness.js", "0")
@@ -49,10 +52,28 @@ class TestWebPlatformTestServer(unittest.TestCase):
         server.start()
         server.stop()
 
+    def test_custom_layout_tests_directory(self):
+        host = MockHost()
+        options = optparse.Values()
+        options.ensure_value("layout_tests_dir", "/mock-layout-tests-directory/LayoutTests")
+        options.ensure_value("results_directory", "/mock/output_dir")
+        port = Port(host, "test", options)
+        server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir/pid.txt")
+        server._check_that_all_ports_are_available = lambda: True
+        server._is_server_running_on_all_ports = lambda: True
+        host.filesystem.write_text_file("/mock-layout-tests-directory/LayoutTests/resources/testharness.js", "0")
+        host.filesystem.write_text_file("/mock-layout-tests-directory/LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js", "0")
+
+        host.filesystem.write_text_file("/mock_output_dir/pid.txt", "0")
+        server.start()
+        server.stop()
+
     def test_corrupted_subserver_files(self):
         host = MockHost()
-        port = Port(host, "test")
-        server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir", "/mock/output_dir/pid.txt")
+        options = optparse.Values()
+        options.ensure_value("results_directory", "/mock/output_dir")
+        port = Port(host, "test", options)
+        server = WebPlatformTestServer(port, "wpttest", "/mock/output_dir/pid.txt")
         server._check_that_all_ports_are_available = lambda: True
         server._is_server_running_on_all_ports = lambda: True
         host.filesystem.write_text_file("/mock-checkout/LayoutTests/resources/testharness.js", "0")
index 974588d..c41d00f 100644 (file)
@@ -911,7 +911,7 @@ class Port(object):
     def start_web_platform_test_server(self, additional_dirs=None, number_of_servers=None):
         assert not self._web_platform_test_server, 'Already running a Web Platform Test server.'
 
-        self._web_platform_test_server = web_platform_test_server.WebPlatformTestServer(self, "wptwk", self.results_directory())
+        self._web_platform_test_server = web_platform_test_server.WebPlatformTestServer(self, "wptwk")
         self._web_platform_test_server.start()
 
     def web_platform_test_server_doc_root(self):