Title: [233843] trunk/Tools
Revision
233843
Author
[email protected]
Date
2018-07-15 23:43:45 -0700 (Sun, 15 Jul 2018)

Log Message

[webkitpy] run-web-platform-tests should allow specifying custom WPT metadata directories
https://bugs.webkit.org/show_bug.cgi?id=187353

Reviewed by Youenn Fablet.

When using run-web-platform-tests, allow specifying custom WPT metadata
directory. This will avoid generating such metadata-filled directory
from the port-specific JSON expectations file, and instead will search
for the metadata files and the include manifest inside the specified
directory. The MANIFEST.json file will also be generated under there.

Rationale for this change is prototyping using custom metadata
directories and avoiding generating all this content from a JSON file.
Using this by default in the future would avoid sporradic changes in how
WPT handles metadata .ini files and releases us from the obligation of
adjusting the generator for every such change. This would also allow
managing this metadata content in a separate repository, avoiding
polluting the main webkit.org repository with thousands of .ini files.

If this turns out to be the preferable way of managing the metadata
content, the JSON files under WebPlatformTests/ and the related code in
wpt_runner.py would be removed.

* Scripts/webkitpy/w3c/wpt_runner.py:
(parse_args):
(WPTRunner._wpt_run_paths):
(WPTRunner.run):
* Scripts/webkitpy/w3c/wpt_runner_unittest.py:
(WPTRunnerTest.test_run_with_specified_options):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (233842 => 233843)


--- trunk/Tools/ChangeLog	2018-07-16 05:22:36 UTC (rev 233842)
+++ trunk/Tools/ChangeLog	2018-07-16 06:43:45 UTC (rev 233843)
@@ -1,3 +1,35 @@
+2018-07-15  Zan Dobersek  <[email protected]>
+
+        [webkitpy] run-web-platform-tests should allow specifying custom WPT metadata directories
+        https://bugs.webkit.org/show_bug.cgi?id=187353
+
+        Reviewed by Youenn Fablet.
+
+        When using run-web-platform-tests, allow specifying custom WPT metadata
+        directory. This will avoid generating such metadata-filled directory
+        from the port-specific JSON expectations file, and instead will search
+        for the metadata files and the include manifest inside the specified
+        directory. The MANIFEST.json file will also be generated under there.
+
+        Rationale for this change is prototyping using custom metadata
+        directories and avoiding generating all this content from a JSON file.
+        Using this by default in the future would avoid sporradic changes in how
+        WPT handles metadata .ini files and releases us from the obligation of
+        adjusting the generator for every such change. This would also allow
+        managing this metadata content in a separate repository, avoiding
+        polluting the main webkit.org repository with thousands of .ini files.
+
+        If this turns out to be the preferable way of managing the metadata
+        content, the JSON files under WebPlatformTests/ and the related code in
+        wpt_runner.py would be removed.
+
+        * Scripts/webkitpy/w3c/wpt_runner.py:
+        (parse_args):
+        (WPTRunner._wpt_run_paths):
+        (WPTRunner.run):
+        * Scripts/webkitpy/w3c/wpt_runner_unittest.py:
+        (WPTRunnerTest.test_run_with_specified_options):
+
 2018-07-13  Ross Kirsling  <[email protected]>
 
         [WinCairo] run-api-tests is timing out for almost all test cases

Modified: trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py (233842 => 233843)


--- trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py	2018-07-16 05:22:36 UTC (rev 233842)
+++ trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py	2018-07-16 06:43:45 UTC (rev 233843)
@@ -104,6 +104,8 @@
                              help='Number of tests to run in parallel'),
     option_parser.add_option('--wpt-checkout', default=None,
                              help='web-platform-tests repository location')
+    option_parser.add_option('--wpt-metadata', default=None,
+                             help='web-platform-tests metadata location')
     option_parser.add_option('--display-server', choices=['xvfb', 'xorg', 'weston', 'wayland'], default='xvfb',
                              help='"xvfb": Use a virtualized X11 server. "xorg": Use the current X11 session. '
                                   '"weston": Use a virtualized Weston server. "wayland": Use the current wayland session.')
@@ -187,29 +189,46 @@
 
         return True
 
+    def _wpt_run_paths(self):
+        test_manifest_file = (self._port.name(), "TestManifest.ini")
+        if not self._options.wpt_metadata:
+            return {'metadata_path': self._port.wpt_metadata_directory(),
+                'include_manifest_path': self._finder.path_from_webkit_base("WebPlatformTests", *test_manifest_file),
+                'manifest_path': self._port.wpt_manifest_file()}
+
+        metadata_path = self._host.filesystem.abspath(self._options.wpt_metadata)
+        return {'metadata_path': metadata_path,
+            'include_manifest_path': self._host.filesystem.join(metadata_path, *test_manifest_file),
+            'manifest_path': self._host.filesystem.join(metadata_path, "MANIFEST.json")}
+
     def run(self, args):
         if not self.prepare_wpt_checkout():
             return False
 
-        # Parse the test expectations JSON and construct corresponding metadata files.
-        metadata_path = self._port.wpt_metadata_directory()
-        if not self._generate_metadata_directory(metadata_path):
-            return False
+        wpt_run_paths = self._wpt_run_paths()
+        if not self._options.wpt_metadata:
+            # Parse the test expectations JSON and construct corresponding metadata files.
+            if not self._generate_metadata_directory(wpt_run_paths["metadata_path"]):
+                return False
 
-        include_manifest_path = self._finder.path_from_webkit_base("WebPlatformTests", self._port.name(), "TestManifest.ini")
-        if not self._host.filesystem.exists(include_manifest_path):
-            _log.error("Port-specific manifest .ini file does not exist")
-            return False
+            # Bail if the include manifest file is not found.
+            if not self._host.filesystem.exists(wpt_run_paths["include_manifest_path"]):
+                _log.error("Port-specific manifest .ini file does not exist")
+                return False
+        else:
+            # Bail if the specified metadata directory is not found.
+            if not self._host.filesystem.exists(wpt_run_paths["metadata_path"]):
+                _log.error("Existing wpt metadata directory has to be specified")
+                return False
 
         # Construct the WebDriver instance and run WPT tests via the 'webkit' product.
-        manifest_path = self._port.wpt_manifest_file()
         webdriver = self._create_webdriver_func(self._port)
 
         wpt_args = ["run", "--webkit-port={}".format(self._port.name()),
             "--processes={}".format(self._options.child_processes),
-            "--metadata={}".format(metadata_path),
-            "--manifest={}".format(manifest_path),
-            "--include-manifest={}".format(include_manifest_path),
+            "--metadata={}".format(wpt_run_paths["metadata_path"]),
+            "--manifest={}".format(wpt_run_paths["manifest_path"]),
+            "--include-manifest={}".format(wpt_run_paths["include_manifest_path"]),
             "--webdriver-binary={}".format(webdriver.binary_path()),
             "--binary={}".format(webdriver.browser_path())]
         wpt_args += ["--binary-arg={}".format(arg) for arg in webdriver.browser_args()]

Modified: trunk/Tools/Scripts/webkitpy/w3c/wpt_runner_unittest.py (233842 => 233843)


--- trunk/Tools/Scripts/webkitpy/w3c/wpt_runner_unittest.py	2018-07-16 05:22:36 UTC (rev 233842)
+++ trunk/Tools/Scripts/webkitpy/w3c/wpt_runner_unittest.py	2018-07-16 06:43:45 UTC (rev 233843)
@@ -233,24 +233,27 @@
         # arguments. Custom WPT checkout and child process count are specified. Note that the
         # WPT checkout doesn't have an impact on the resulting WPT argument list, as intended.
         specified_wpt_checkout = "/mock-path/web-platform-tests"
+        specified_wpt_metadata = "/mock-path/wpt-metadata"
         specified_child_processes = 16
 
         spawn_wpt_func = WPTRunnerTest.MockSpawnWPT(self, specified_wpt_checkout,
             ["run", "--webkit-port=MockPort", "--processes=16",
-                "--metadata=/mock-path/mock-wpt-tests-metadata",
-                "--manifest=/mock-path/mock-wpt-manifest.json",
-                "--include-manifest=/mock-checkout/WebPlatformTests/MockPort/TestManifest.ini",
+                "--metadata=/mock-path/wpt-metadata",
+                "--manifest=/mock-path/wpt-metadata/MANIFEST.json",
+                "--include-manifest=/mock-path/wpt-metadata/MockPort/TestManifest.ini",
                 "--webdriver-binary=/mock-webdriver/bin/webdriver",
                 "--binary=/mock-webdriver/bin/browser",
                 "--binary-arg=webdriver_arg1", "--binary-arg=webdriver_arg2", "webkit"])
 
         options, _ = parse_args(["--wpt-checkout", specified_wpt_checkout,
+            "--wpt-metadata", specified_wpt_metadata,
             "--child-processes", specified_child_processes])
         instance = WPTRunnerTest.TestInstance(options, spawn_wpt_func)
         instance.prepare_mock_files_for_run()
 
-        # Also create the mock WPT checkout directory.
+        # Also create the mock WPT checkout and metadata directories.
         instance.host.filesystem.maybe_make_directory(specified_wpt_checkout)
+        instance.host.filesystem.maybe_make_directory(specified_wpt_metadata)
 
         self.assertTrue(instance.runner.run([]))
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to