Tools:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 03:16:20 +0000 (03:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 03:16:20 +0000 (03:16 +0000)
Allow WPT server to serve specific WebKit test
https://bugs.webkit.org/show_bug.cgi?id=171479

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-11
Reviewed by Ryosuke Niwa.

Adding a new mount point to WPT server.
It points to LayoutTests/http/wpt folder and is triggered on "/WebKit" urls.

Updating the webkitpy infrastructure to launch WPT server and do test url mapping for LayoutTests/wpt tests.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.__init__):
(Manager._is_http_test):
(Manager._needs_web_platform_test):
(Manager._run_tests):
(Manager._is_web_platform_test): Deleted.
* Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:
(build_routes):
(main):
* Scripts/webkitpy/port/driver.py:
(Driver):
(Driver.is_webkit_specific_web_platform_test):
(Driver.test_to_uri):
(Driver._command_from_driver_input):

LayoutTests:
Allow WPT server to serve specific WebKit tests
https://bugs.webkit.org/show_bug.cgi?id=171479

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-11
Reviewed by Ryosuke Niwa.

Moving tests to ensure they are correctly runned.

* http/wpt/fetch/fetch-as-blob-expected.txt: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-expected.txt.
* http/wpt/fetch/fetch-as-blob-worker-expected.txt: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-worker-expected.txt.
* http/wpt/fetch/fetch-as-blob-worker.html: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-worker.html.
* http/wpt/fetch/fetch-as-blob.html: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob.html.
* http/wpt/fetch/fetch-as-blob.js: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob.js.
(promise_test):

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/fetch/fetch-as-blob-expected.txt [moved from LayoutTests/http/tests/fetch/fetch-as-blob-expected.txt with 100% similarity]
LayoutTests/http/wpt/fetch/fetch-as-blob-worker-expected.txt [moved from LayoutTests/http/tests/fetch/fetch-as-blob-worker-expected.txt with 100% similarity]
LayoutTests/http/wpt/fetch/fetch-as-blob-worker.html [moved from LayoutTests/http/tests/fetch/fetch-as-blob-worker.html with 100% similarity]
LayoutTests/http/wpt/fetch/fetch-as-blob.html [moved from LayoutTests/http/tests/fetch/fetch-as-blob.html with 100% similarity]
LayoutTests/http/wpt/fetch/fetch-as-blob.js [moved from LayoutTests/http/tests/fetch/fetch-as-blob.js with 100% similarity]
Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py
Tools/Scripts/webkitpy/port/driver.py
Tools/Scripts/webkitpy/port/driver_unittest.py

index 43bb88c..007f35e 100644 (file)
@@ -1,5 +1,21 @@
 2017-05-11  Youenn Fablet  <youenn@apple.com>
 
+        Allow WPT server to serve specific WebKit tests
+        https://bugs.webkit.org/show_bug.cgi?id=171479
+
+        Reviewed by Ryosuke Niwa.
+
+        Moving tests to ensure they are correctly runned.
+
+        * http/wpt/fetch/fetch-as-blob-expected.txt: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-expected.txt.
+        * http/wpt/fetch/fetch-as-blob-worker-expected.txt: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-worker-expected.txt.
+        * http/wpt/fetch/fetch-as-blob-worker.html: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob-worker.html.
+        * http/wpt/fetch/fetch-as-blob.html: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob.html.
+        * http/wpt/fetch/fetch-as-blob.js: Renamed from LayoutTests/http/tests/fetch/fetch-as-blob.js.
+        (promise_test):
+
+2017-05-11  Youenn Fablet  <youenn@apple.com>
+
         [iOS] Unset active media capture source when stopped capturing
         https://bugs.webkit.org/show_bug.cgi?id=171815
         <rdar://problem/32117885>
index f5b4d86..d55257a 100644 (file)
@@ -1,3 +1,30 @@
+2017-05-11  Youenn Fablet  <youenn@apple.com>
+
+        Allow WPT server to serve specific WebKit test
+        https://bugs.webkit.org/show_bug.cgi?id=171479
+
+        Reviewed by Ryosuke Niwa.
+
+        Adding a new mount point to WPT server.
+        It points to LayoutTests/http/wpt folder and is triggered on "/WebKit" urls.
+
+        Updating the webkitpy infrastructure to launch WPT server and do test url mapping for LayoutTests/wpt tests.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.__init__):
+        (Manager._is_http_test):
+        (Manager._needs_web_platform_test):
+        (Manager._run_tests):
+        (Manager._is_web_platform_test): Deleted.
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_launcher.py:
+        (build_routes):
+        (main):
+        * Scripts/webkitpy/port/driver.py:
+        (Driver):
+        (Driver.is_webkit_specific_web_platform_test):
+        (Driver.test_to_uri):
+        (Driver._command_from_driver_input):
+
 2017-05-11  Brady Eidson  <beidson@apple.com>
 
         [WKWebsiteDataStore removeDataOfTypes:...] doesn't work for IndexedDB if the data store has a custom IDB path.
index a77619e..e91bcc3 100644 (file)
@@ -78,9 +78,10 @@ class Manager(object):
         self._options = options
         self._printer = printer
         self._expectations = None
-        self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR
+        self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR + 'test'
         self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR
         self.web_platform_test_subdir = self._port.web_platform_test_server_doc_root()
+        self.webkit_specific_web_platform_test_subdir = 'http' + port.TEST_PATH_SEPARATOR + 'wpt' + port.TEST_PATH_SEPARATOR
         self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
         self._results_directory = self._port.results_directory()
         self._finder = LayoutTestFinder(self._port, self._options)
@@ -93,13 +94,13 @@ class Manager(object):
         return self._finder.find_tests(self._options, args)
 
     def _is_http_test(self, test):
-        return self.HTTP_SUBDIR in test or self._is_websocket_test(test) or self._is_web_platform_test(test)
+        return self.HTTP_SUBDIR in test or self._is_websocket_test(test) or self._needs_web_platform_test(test)
 
     def _is_websocket_test(self, test):
         return self.WEBSOCKET_SUBDIR in test
 
-    def _is_web_platform_test(self, test):
-        return self.web_platform_test_subdir in test
+    def _needs_web_platform_test(self, test):
+        return self.web_platform_test_subdir in test or self.webkit_specific_web_platform_test_subdir in test
 
     def _custom_device_for_test(self, test):
         for device_class in self._port.CUSTOM_DEVICE_CLASSES:
@@ -317,8 +318,8 @@ class Manager(object):
         return test_run_results.RunDetails(exit_code, summarized_results, initial_results, retry_results, enabled_pixel_tests_in_retry)
 
     def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations, num_workers, retrying):
-        needs_http = any((self._is_http_test(test) and not self._is_web_platform_test(test)) for test in tests_to_run)
-        needs_web_platform_test_server = any(self._is_web_platform_test(test) for test in tests_to_run)
+        needs_http = any((self._is_http_test(test) and not self._needs_web_platform_test(test)) for test in tests_to_run)
+        needs_web_platform_test_server = any(self._needs_web_platform_test(test) for test in tests_to_run)
         needs_websockets = any(self._is_websocket_test(test) for test in tests_to_run)
 
         test_inputs = self._get_test_inputs(tests_to_run, repeat_each, iterations)
index c92801b..c792bc9 100644 (file)
@@ -65,6 +65,9 @@ class ManagerTest(unittest.TestCase):
         self.assertTrue(manager.needs_servers(['imported/w3c/wpt/test']))
 
         manager = get_manager()
+        self.assertTrue(manager.needs_servers(['http/wpt/funky']))
+
+        manager = get_manager()
         self.assertFalse(manager.needs_servers(['imported/w3c']))
 
     def integration_test_needs_servers(self):
index 4ce2518..a5cf44e 100755 (executable)
@@ -20,10 +20,26 @@ except ImportError, e:
         "Please check that the file serve.py is present in the web-platform-tests folder.\n"
         "Please also check that __init__.py files in the web-platform-tests/tools folder and subfolders are also present.")
     raise
-
 # This script is used to launch the web platform test server main script (serve.py) and stop it when asked by run-webkit-tests
 
 
+def build_routes(aliases):
+    builder = WebPlatformTestServer.RoutesBuilder()
+    for alias in aliases:
+        url = alias["url-path"]
+        directory = alias["local-dir"]
+        if not url.startswith("/") or len(directory) == 0:
+            logger.error("\"url-path\" value must start with '/'.")
+            continue
+        if url.endswith("/"):
+            logger.info("\n\nadding mount point " + url + " " + directory + "\n\n")
+            builder.add_mount_point(url, directory)
+        else:
+            builder.add_file_mount_point(url, directory)
+    builder.add_mount_point("/WebKit/", "../../../http/wpt/")
+    return builder.get_routes()
+
+
 def main(argv, stdout, stderr):
     # This is a copy of serve.py main function, except for the wait step
     config = WebPlatformTestServer.load_config("config.default.json", "config.json")
@@ -32,7 +48,7 @@ def main(argv, stdout, stderr):
 
     with stash.StashServer((config["host"], WebPlatformTestServer.get_port()), authkey=str(uuid.uuid4())):
         with WebPlatformTestServer.get_ssl_environment(config) as ssl_env:
-            config_, started_servers = WebPlatformTestServer.start(config, ssl_env, WebPlatformTestServer.build_routes(config["aliases"]))
+            config_, started_servers = WebPlatformTestServer.start(config, ssl_env, build_routes(config["aliases"]))
 
             for protocol, servers in started_servers.items():
                 for port, process in servers:
index a243761..d079555 100644 (file)
@@ -254,10 +254,15 @@ class Driver(object):
 
     HTTP_DIR = "http/tests/"
     HTTP_LOCAL_DIR = "http/tests/local/"
+    WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR = "http/wpt/"
+    WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE = "WebKit/"
 
     def is_http_test(self, test_name):
         return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(self.HTTP_LOCAL_DIR)
 
+    def is_webkit_specific_web_platform_test(self, test_name):
+        return test_name.startswith(self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
+
     def is_web_platform_test(self, test_name):
         return test_name.startswith(self.web_platform_test_server_doc_root)
 
@@ -265,6 +270,8 @@ class Driver(object):
         """Convert a test name to a URI."""
         if self.is_web_platform_test(test_name):
             return self.web_platform_test_server_base_url + test_name[len(self.web_platform_test_server_doc_root):]
+        if self.is_webkit_specific_web_platform_test(test_name):
+            return self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE + test_name[len(self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR):]
 
         if not self.is_http_test(test_name):
             return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))
@@ -289,6 +296,8 @@ class Driver(object):
             if not prefix.endswith('/'):
                 prefix += '/'
             return uri[len(prefix):]
+        if uri.startswith(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
+            return uri.replace(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE, self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
         if uri.startswith(self.web_platform_test_server_base_url):
             return uri.replace(self.web_platform_test_server_base_url, self.web_platform_test_server_doc_root)
         if uri.startswith("http://"):
@@ -472,7 +481,7 @@ class Driver(object):
         # FIXME: performance tests pass in full URLs instead of test names.
         if driver_input.test_name.startswith('http://') or driver_input.test_name.startswith('https://')  or driver_input.test_name == ('about:blank'):
             command = driver_input.test_name
-        elif self.is_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == "cygwin")):
+        elif self.is_web_platform_test(driver_input.test_name) or self.is_webkit_specific_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == "cygwin")):
             command = self.test_to_uri(driver_input.test_name)
             command += "'--absolutePath'"
             command += self._port.abspath_for_test(driver_input.test_name, self._target_host)
index 8cfc78e..ae4b793 100644 (file)
@@ -118,6 +118,7 @@ class DriverTest(unittest.TestCase):
         self.assertEqual(driver.test_to_uri('http/tests/foo.html'), 'http://127.0.0.1:8000/foo.html')
         self.assertEqual(driver.test_to_uri('http/tests/ssl/bar.html'), 'https://127.0.0.1:8443/ssl/bar.html')
         self.assertEqual(driver.test_to_uri('imported/w3c/web-platform-tests/foo/bar.html'), 'http://localhost:8800/foo/bar.html')
+        self.assertEqual(driver.test_to_uri('http/wpt/bar2.html'), 'http://localhost:8800/WebKit/bar2.html')
 
     def test_uri_to_test(self):
         port = self.make_port()
@@ -126,6 +127,7 @@ class DriverTest(unittest.TestCase):
         self.assertEqual(driver.uri_to_test('http://127.0.0.1:8000/foo.html'), 'http/tests/foo.html')
         self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/ssl/bar.html'), 'http/tests/ssl/bar.html')
         self.assertEqual(driver.uri_to_test('http://localhost:8800/foo/bar.html'), 'imported/w3c/web-platform-tests/foo/bar.html')
+        self.assertEqual(driver.uri_to_test('http://localhost:8800/WebKit/bar2.html'), 'http/wpt/bar2.html')
 
     def test_read_block(self):
         port = TestWebKitPort()