Title: [210523] trunk/Tools
Revision
210523
Author
clo...@igalia.com
Date
2017-01-09 14:28:43 -0800 (Mon, 09 Jan 2017)

Log Message

[GTK][Wayland] Allow running the layout tests under a native Wayland environment.
https://bugs.webkit.org/show_bug.cgi?id=165232

Reviewed by Michael Catanzaro.

Add a new WaylandDriver to run the tests in the user current wayland session.

Also merge all the configuration options for selecting the display server inside one
switch --display-server=xvfb/xorg/wayland/weston (defaulting to xvfb).

This switch is supported on the scripts: run-gtk-tests, run-perf-tests and run-webkit-tests.

* Scripts/run-gtk-tests: Add missing logging.basicConfig() initialization for the error logger.
(TestRunner._create_driver):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._parse_args):
* Scripts/webkitpy/port/gtk.py:
(GtkPort.__init__):
(GtkPort._driver_class):
(GtkPort._search_paths):
* Scripts/webkitpy/port/waylanddriver.py: Added.
(WaylandDriver):
(WaylandDriver.check_driver):
(WaylandDriver._setup_environ_for_test):
(WaylandDriver._start):

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (210522 => 210523)


--- trunk/Tools/ChangeLog	2017-01-09 22:02:47 UTC (rev 210522)
+++ trunk/Tools/ChangeLog	2017-01-09 22:28:43 UTC (rev 210523)
@@ -1,3 +1,33 @@
+2017-01-09  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        [GTK][Wayland] Allow running the layout tests under a native Wayland environment.
+        https://bugs.webkit.org/show_bug.cgi?id=165232
+
+        Reviewed by Michael Catanzaro.
+
+        Add a new WaylandDriver to run the tests in the user current wayland session.
+
+        Also merge all the configuration options for selecting the display server inside one
+        switch --display-server=xvfb/xorg/wayland/weston (defaulting to xvfb).
+
+        This switch is supported on the scripts: run-gtk-tests, run-perf-tests and run-webkit-tests.
+
+        * Scripts/run-gtk-tests: Add missing logging.basicConfig() initialization for the error logger.
+        (TestRunner._create_driver):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args):
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner._parse_args):
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort.__init__):
+        (GtkPort._driver_class):
+        (GtkPort._search_paths):
+        * Scripts/webkitpy/port/waylanddriver.py: Added.
+        (WaylandDriver):
+        (WaylandDriver.check_driver):
+        (WaylandDriver._setup_environ_for_test):
+        (WaylandDriver._start):
+
 2017-01-09  Andy Estes  <aes...@apple.com>
 
         [QuickLook] Add a layout test for webkit.org/b/135651

Modified: trunk/Tools/Scripts/run-gtk-tests (210522 => 210523)


--- trunk/Tools/Scripts/run-gtk-tests	2017-01-09 22:02:47 UTC (rev 210522)
+++ trunk/Tools/Scripts/run-gtk-tests	2017-01-09 22:28:43 UTC (rev 210523)
@@ -17,6 +17,7 @@
 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
+import logging
 import subprocess
 import os
 import sys
@@ -209,10 +210,7 @@
         return True
 
     def _create_driver(self, port_options=[]):
-        if self._options.use_wayland:
-            self._port._wayland = True
-        else:
-            self._port._nativexorg = not self._options.use_xvfb
+        self._port._display_server = self._options.display_server
         driver = self._port.create_driver(worker_number=0, no_timeout=True)._make_driver(pixel_tests=False)
         if not driver.check_driver(self._port):
             raise RuntimeError("Failed to check driver %s" %driver.__class__.__name__)
@@ -486,11 +484,12 @@
     option_parser.add_option('-t', '--timeout',
                              action='', type='int', dest='timeout', default=10,
                              help='Time in seconds until a test times out')
-    option_parser.add_option('--no-xvfb', action='', dest='use_xvfb', default=True,
-                             help='Do not run tests under Xvfb')
-    option_parser.add_option('--wayland', action='', dest='use_wayland', default=False,
-                             help='Run the layout tests inside a (virtualized) weston')
+    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.'),
     options, args = option_parser.parse_args()
 
+    logging.basicConfig(level=logging.INFO, format="%(message)s")
+
     runner = TestRunner(options, args)
     sys.exit(runner.run_tests())

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (210522 => 210523)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2017-01-09 22:02:47 UTC (rev 210522)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2017-01-09 22:28:43 UTC (rev 210523)
@@ -289,8 +289,9 @@
         optparse.make_option("--profiler", action=""
             help="Output per-test profile information, using the specified profiler."),
         optparse.make_option("--no-timeout", action="" default=False, help="Disable test timeouts"),
-        optparse.make_option("--wayland",  action="" default=False,
-            help="Run the layout tests inside a (virtualized) weston compositor (GTK only)."),
+        optparse.make_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.'),
     ]))
 
     option_group_definitions.append(("iOS Simulator Options", [

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (210522 => 210523)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2017-01-09 22:02:47 UTC (rev 210522)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2017-01-09 22:28:43 UTC (rev 210523)
@@ -135,6 +135,9 @@
                 help="wrapper command to insert before invocations of "
                  "DumpRenderTree or WebKitTestRunner; option is split on whitespace before "
                  "running. (Example: --wrapper='valgrind --smc-check=all')"),
+            optparse.make_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.'),
             ]
         return optparse.OptionParser(option_list=(perf_option_list)).parse_args(args)
 

Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (210522 => 210523)


--- trunk/Tools/Scripts/webkitpy/port/gtk.py	2017-01-09 22:02:47 UTC (rev 210522)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py	2017-01-09 22:28:43 UTC (rev 210523)
@@ -1,5 +1,6 @@
 # Copyright (C) 2010 Google Inc. All rights reserved.
 # Copyright (C) 2013 Samsung Electronics.  All rights reserved.
+# Copyright (C) 2017 Igalia S.L. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -40,6 +41,7 @@
 from webkitpy.port.xvfbdriver import XvfbDriver
 from webkitpy.port.westondriver import WestonDriver
 from webkitpy.port.xorgdriver import XorgDriver
+from webkitpy.port.waylanddriver import WaylandDriver
 from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
 from webkitpy.port.leakdetector_valgrind import LeakDetectorValgrind
 
@@ -52,10 +54,7 @@
     def __init__(self, *args, **kwargs):
         super(GtkPort, self).__init__(*args, **kwargs)
         self._pulseaudio_sanitizer = PulseAudioSanitizer()
-        self._wayland = self.get_option("wayland")
-        self._nativexorg = False
-        if os.environ.get("USE_NATIVE_XDISPLAY"):
-            self._nativexorg = True
+        self._display_server = self.get_option("display_server")
 
         if self.get_option("leaks"):
             self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory())
@@ -80,9 +79,12 @@
 
     @memoized
     def _driver_class(self):
-        if self._wayland:
+        if self._display_server == "weston":
             return WestonDriver
-        if self._nativexorg:
+        if self._display_server == "wayland":
+            return WaylandDriver
+        # FIXME: re-configure the perf bot to pass --display-server=xorg
+        if self._display_server == "xorg" or os.environ.get("USE_NATIVE_XDISPLAY"):
             return XorgDriver
         return XvfbDriver
 
@@ -190,7 +192,7 @@
 
     def _search_paths(self):
         search_paths = []
-        if self._wayland:
+        if self._driver_class() in [WaylandDriver, WestonDriver]:
             search_paths.append(self.port_name + "-wayland")
         search_paths.append(self.port_name)
         search_paths.append('wk2')

Added: trunk/Tools/Scripts/webkitpy/port/waylanddriver.py (0 => 210523)


--- trunk/Tools/Scripts/webkitpy/port/waylanddriver.py	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/waylanddriver.py	2017-01-09 22:28:43 UTC (rev 210523)
@@ -0,0 +1,64 @@
+# Copyright (C) 2016 Igalia S.L. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+#     * 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.
+#
+#     * Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+# OWNER OR 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.
+
+import logging
+import os
+
+from webkitpy.port.driver import Driver
+
+_log = logging.getLogger(__name__)
+
+
+class WaylandDriver(Driver):
+    @staticmethod
+    def check_driver(port):
+        if "WAYLAND_DISPLAY" not in os.environ:
+                _log.error("WAYLAND_DISPLAY not found in the environment. Cannot run tests.")
+                return False
+        return True
+
+    def _setup_environ_for_test(self):
+        driver_environment = self._port.setup_environ_for_server(self._server_name)
+        driver_environment['WAYLAND_DISPLAY'] = os.environ.get('WAYLAND_DISPLAY')
+        driver_environment['GDK_BACKEND'] = 'wayland'
+        if driver_environment.get('DISPLAY'):
+            del driver_environment['DISPLAY']
+        driver_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
+        driver_environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
+        driver_environment['XDG_CACHE_HOME'] = self._port.host.filesystem.join(str(self._driver_tempdir), 'appcache')
+        return driver_environment
+
+    def _start(self, pixel_tests, per_test_args):
+        super(WaylandDriver, self).stop()
+        self._driver_tempdir = self._port.host.filesystem.mkdtemp(prefix='%s-' % self._server_name)
+        self._crashed_process_name = None
+        self._crashed_pid = None
+        self._server_process = self._port._server_process_constructor(self._port, self._server_name, self.cmd_line(pixel_tests, per_test_args), self._setup_environ_for_test())
+        self._server_process.start()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to