Diff
Modified: trunk/Tools/ChangeLog (263624 => 263625)
--- trunk/Tools/ChangeLog 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/ChangeLog 2020-06-27 17:00:49 UTC (rev 263625)
@@ -1,3 +1,38 @@
+2020-06-27 Philippe Normand <pnorm...@igalia.com>
+
+ Migrate run-minibrowser to webkitpy
+ https://bugs.webkit.org/show_bug.cgi?id=213431
+
+ Reviewed by Jonathan Bedard.
+
+ The perl version was renamed to old-run-minibrowser and remains used by the Mac ports.
+ run-minibrowser is now a Python script hooking into webkitpy and the Port infrastructure.
+ Both WPE and GTK ports will now use the pure python implementation.
+
+ * Scripts/old-run-minibrowser: Copied from Tools/Scripts/run-minibrowser.
+ * Scripts/run-minibrowser:
+ * Scripts/webkitpy/minibrowser/run_minibrowser.py: Added.
+ (main):
+ (parse_args):
+ * Scripts/webkitpy/port/base.py:
+ (Port.run_minibrowser_arguments):
+ (Port):
+ (Port.run_minibrowser):
+ * Scripts/webkitpy/port/darwin.py:
+ (DarwinPort.environment_for_api_tests):
+ (DarwinPort):
+ (DarwinPort.run_minibrowser_arguments):
+ * Scripts/webkitpy/port/gtk.py:
+ (GtkPort.show_results_html_file):
+ (GtkPort.configuration_for_upload):
+ (GtkPort):
+ (GtkPort.run_minibrowser):
+ * Scripts/webkitpy/port/wpe.py:
+ (WPEPort.show_results_html_file):
+ (WPEPort.configuration_for_upload):
+ (WPEPort):
+ (WPEPort.run_minibrowser):
+
2020-06-27 Stephan Szabo <stephan.sz...@sony.com>
[PlayStation] Update test runner for changes to Options and signing
Copied: trunk/Tools/Scripts/old-run-minibrowser (from rev 263624, trunk/Tools/Scripts/run-minibrowser) (0 => 263625)
--- trunk/Tools/Scripts/old-run-minibrowser (rev 0)
+++ trunk/Tools/Scripts/old-run-minibrowser 2020-06-27 17:00:49 UTC (rev 263625)
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved.
+# Copyright (C) 2007 Staikos Computing Services, Inc. <i...@staikos.net>
+
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Simplified "run" script for launching the WebKit2 MiniBrowser.
+
+use strict;
+use warnings;
+use FindBin;
+use lib $FindBin::Bin;
+use webkitdirs;
+
+prohibitUnknownPort();
+setConfiguration();
+
+if (isAppleCocoaWebKit()) {
+ printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+ exit exitStatus(runMiniBrowser());
+} else {
+ die "Unsupported platform."
+}
Modified: trunk/Tools/Scripts/run-minibrowser (263624 => 263625)
--- trunk/Tools/Scripts/run-minibrowser 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/Scripts/run-minibrowser 2020-06-27 17:00:49 UTC (rev 263625)
@@ -1,64 +1,30 @@
-#!/usr/bin/env perl
-
-# Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved.
-# Copyright (C) 2007 Staikos Computing Services, Inc. <i...@staikos.net>
-
+#!/usr/bin/env python
+# Copyright (C) 2020 Igalia S.L.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301, USA.
-# Simplified "run" script for launching the WebKit2 MiniBrowser.
+"""Wrapper around webkitpy/minibrowser/run_webkit_app.py"""
+import os
+import sys
+from webkitpy.minibrowser import run_webkit_app
-use strict;
-use warnings;
-use File::Spec::Functions qw/catdir/;
-use FindBin;
-use lib $FindBin::Bin;
-use webkitdirs;
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+if sys.platform.startswith('linux'):
+ sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+ import flatpakutils
+ flatpakutils.run_in_sandbox_if_available(sys.argv)
-my $launcherName;
-my $launcherPath;
-my @jhbuildWrapper;
-
-prohibitUnknownPort();
-setConfiguration();
-
-if (isGtk() || isWPE()) {
- my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "run-minibrowser"));
- runInFlatpakIfAvailable(@command);
-
- # Check to see that all the frameworks are built.
- checkFrameworks();
-
- $launcherPath = catdir(productDir(), "bin", "MiniBrowser");
- die "Can't find $launcherPath" unless -x $launcherPath;
- @jhbuildWrapper = wrapperPrefixIfNeeded();
- print "Starting MiniBrowser.\n";
- exec @jhbuildWrapper, $launcherPath, @ARGV or die;
-} elsif (isAppleCocoaWebKit()) {
- printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
- exit exitStatus(runMiniBrowser());
-} else {
- die "Unsupported platform."
-}
+run_webkit_app.main(sys.argv[1:])
Added: trunk/Tools/Scripts/webkitpy/minibrowser/__init__.py ( => )
Added: trunk/Tools/Scripts/webkitpy/minibrowser/run_webkit_app.py
===================================================================
--- trunk/Tools/Scripts/webkitpy/minibrowser/run_webkit_app.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/minibrowser/run_webkit_app.py 2020-06-27 17:00:49 UTC (rev 263625)
@@ -0,0 +1,66 @@
+# pylint: disable=E1103
+# Copyright (C) 2020 Igalia S.L.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+from __future__ import print_function
+import argparse
+import os
+import sys
+import traceback
+
+from webkitpy.common.host import Host
+from webkitpy.port import configuration_options, platform_options, factory
+
+
+def main(argv):
+ option_parser = argparse.ArgumentParser(usage="%(prog)s [options] [url]", add_help=False)
+ groups = [("Platform options", platform_options()), ("Configuration options", configuration_options())]
+
+ # Convert options to argparse, so that we can use parse_known_args() which is not supported in optparse.
+ # FIXME: Globally migrate to argparse. https://bugs.webkit.org/show_bug.cgi?id=213463
+ for group_name, group_options in groups:
+ option_group = option_parser.add_argument_group(group_name)
+
+ for option in group_options:
+ # Skip deprecated option
+ if option.dest == "configuration":
+ continue
+ default = None
+ if option.default != ("NO", "DEFAULT"):
+ default = option.default
+ option_group.add_argument(option.get_opt_string(), action="" dest=option.dest,
+ help=option.help, const=option.const, default=default)
+
+ options, args = option_parser.parse_known_args(argv)
+
+ if set(args).issubset(["-h", "--help"]) and not options.platform:
+ option_parser.print_help()
+ print("\nTo see the available options on a specific platform, supply it on the command-line, for example --gtk --help")
+ return 0
+
+ try:
+ port = factory.PortFactory(Host()).get(options.platform, options=options)
+ return port.run_minibrowser(args)
+ except BaseException as e:
+ if isinstance(e, Exception):
+ print('\n%s raised: %s' % (e.__class__.__name__, str(e)), file=sys.stderr)
+ traceback.print_exc(file=sys.stderr)
+ return 1
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
Modified: trunk/Tools/Scripts/webkitpy/port/base.py (263624 => 263625)
--- trunk/Tools/Scripts/webkitpy/port/base.py 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/Scripts/webkitpy/port/base.py 2020-06-27 17:00:49 UTC (rev 263625)
@@ -30,6 +30,7 @@
"""Abstract base class of Port-specific entry points for the layout tests
test infrastructure (the Port and Driver classes)."""
+import argparse
import difflib
import json
import logging
@@ -789,7 +790,12 @@
return self.get_option(name) == value
def set_option_default(self, name, default_value):
- return self._options.ensure_value(name, default_value)
+ if isinstance(self._options, argparse.Namespace):
+ if not hasattr(self._options, name):
+ setattr(self._options, name, default_value)
+ return True
+ else:
+ return self._options.ensure_value(name, default_value)
@memoized
def path_to_generic_test_expectations_file(self):
@@ -1361,6 +1367,10 @@
"""Returns the full path to the default ImageDiff binary, or None if it is not available."""
return self._build_path('ImageDiff')
+ def run_minibrowser(self, args):
+ # FIXME: Migrate to webkitpy based run-minibrowser. https://bugs.webkit.org/show_bug.cgi?id=213464
+ return self._run_script(["old-run-minibrowser", ] + args)
+
@memoized
def _path_to_image_diff(self):
"""Returns the full path to the image_diff binary, or None if it is not available.
Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (263624 => 263625)
--- trunk/Tools/Scripts/webkitpy/port/gtk.py 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py 2020-06-27 17:00:49 UTC (rev 263625)
@@ -231,7 +231,7 @@
self._leakdetector.parse_and_print_leaks_detail(leaks_files)
def show_results_html_file(self, results_filename):
- self._run_script("run-minibrowser", [path.abspath_to_uri(self.host.platform, results_filename)])
+ self.run_minibrowser([path.abspath_to_uri(self.host.platform, results_filename)])
def check_sys_deps(self):
return super(GtkPort, self).check_sys_deps() and self._driver_class().check_driver(self)
@@ -260,3 +260,13 @@
configuration['platform'] = 'GTK'
configuration['version_name'] = self._display_server.capitalize() if self._display_server else 'Xvfb'
return configuration
+
+ def run_minibrowser(self, args):
+ miniBrowser = self._build_path('bin', 'MiniBrowser')
+ if not self._filesystem.isfile(miniBrowser):
+ print("%s not found... Did you run build-webkit?" % miniBrowser)
+ return 1
+ command = [miniBrowser]
+ if self._should_use_jhbuild():
+ command = self._jhbuild_wrapper + command
+ return self._executive.run_command(command + args, cwd=self.webkit_base())
Modified: trunk/Tools/Scripts/webkitpy/port/gtk_unittest.py (263624 => 263625)
--- trunk/Tools/Scripts/webkitpy/port/gtk_unittest.py 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/Scripts/webkitpy/port/gtk_unittest.py 2020-06-27 17:00:49 UTC (rev 263625)
@@ -69,7 +69,10 @@
def test_show_results_html_file(self):
port = self.make_port()
port._executive = MockExecutive(should_log=True)
- expected_logs = "MOCK run_command: ['Tools/Scripts/run-minibrowser', '--release', '--gtk', 'file://test.html'], cwd=/mock-checkout\n"
+ port._filesystem = MockFileSystem({
+ "/mock-build/bin/MiniBrowser": ""
+ })
+ expected_logs = "MOCK run_command: ['/mock-build/bin/MiniBrowser', 'file://test.html'], cwd=/mock-checkout\n"
OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_logs=expected_logs)
def test_default_timeout_ms(self):
Modified: trunk/Tools/Scripts/webkitpy/port/wpe.py (263624 => 263625)
--- trunk/Tools/Scripts/webkitpy/port/wpe.py 2020-06-27 16:44:03 UTC (rev 263624)
+++ trunk/Tools/Scripts/webkitpy/port/wpe.py 2020-06-27 17:00:49 UTC (rev 263625)
@@ -93,7 +93,7 @@
return environment
def show_results_html_file(self, results_filename):
- self._run_script("run-minibrowser", [path.abspath_to_uri(self.host.platform, results_filename)])
+ self.run_minibrowser([path.abspath_to_uri(self.host.platform, results_filename)])
def check_sys_deps(self):
return super(WPEPort, self).check_sys_deps() and self._driver_class().check_driver(self)
@@ -134,3 +134,13 @@
configuration = super(WPEPort, self).configuration_for_upload(host=host)
configuration['platform'] = 'WPE'
return configuration
+
+ def run_minibrowser(self, args):
+ miniBrowser = self._build_path('bin', 'MiniBrowser')
+ if not self._filesystem.isfile(miniBrowser):
+ print("%s not found... Did you run build-webkit?" % miniBrowser)
+ return 1
+ command = [miniBrowser]
+ if self._should_use_jhbuild():
+ command = self._jhbuild_wrapper + command
+ return self._executive.run_command(command + args, cwd=self.webkit_base())