<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169344] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169344">169344</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-26 07:19:51 -0700 (Mon, 26 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Allow to run the tests on the native X display.
https://bugs.webkit.org/show_bug.cgi?id=133157

Patch by Carlos Alberto Lopez Perez &lt;clopez@igalia.com&gt; on 2014-05-26
Reviewed by Benjamin Poulain.

This adds a new driver (xorgdriver) that runs the tests on the
X display referenced by the environment variable DISPLAY.

This new driver will be activated only if the environment variable
USE_NATIVE_XDISPLAY is defined. This can be used both for layout
tests and performance tests.

This patch also makes the script run-perf-tests to check the
system dependencies before starting the tests. Previously this
was not checked, and if the system dependencies were not met,
the script tried to execute the tests anyway, causing massive
failures. For example, if you had Xvfb not installed and you
wanted to use the Xvfb driver (the default on GTK and EFL),
run-perf-tests would not abort.

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._parse_args): Check the system dependencies of
the driver before starting the tests.
* Scripts/webkitpy/port/driver.py:
(Driver): Implement generic check_driver method.
(Driver.check_driver):
(Driver.check_driver.implementation):
* Scripts/webkitpy/port/gtk.py:
(GtkPort._driver_class): Check for environment variable
USE_NATIVE_XDISPLAY to decide if the Xorg driver should be used.
* Scripts/webkitpy/port/xorgdriver.py: Added.
(XorgDriver): Implement Xorg driver.
(XorgDriver.check_driver):
(XorgDriver._start):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyperformance_testsperftestsrunnerpy">trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportgtkpy">trunk/Tools/Scripts/webkitpy/port/gtk.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitpyportxorgdriverpy">trunk/Tools/Scripts/webkitpy/port/xorgdriver.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (169343 => 169344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-05-26 14:16:05 UTC (rev 169343)
+++ trunk/Tools/ChangeLog        2014-05-26 14:19:51 UTC (rev 169344)
</span><span class="lines">@@ -1,5 +1,42 @@
</span><span class="cx"> 2014-05-26  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        [GTK] Allow to run the tests on the native X display.
+        https://bugs.webkit.org/show_bug.cgi?id=133157
+
+        Reviewed by Benjamin Poulain.
+
+        This adds a new driver (xorgdriver) that runs the tests on the
+        X display referenced by the environment variable DISPLAY.
+
+        This new driver will be activated only if the environment variable
+        USE_NATIVE_XDISPLAY is defined. This can be used both for layout
+        tests and performance tests.
+
+        This patch also makes the script run-perf-tests to check the
+        system dependencies before starting the tests. Previously this
+        was not checked, and if the system dependencies were not met,
+        the script tried to execute the tests anyway, causing massive
+        failures. For example, if you had Xvfb not installed and you
+        wanted to use the Xvfb driver (the default on GTK and EFL),
+        run-perf-tests would not abort.
+
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner._parse_args): Check the system dependencies of
+        the driver before starting the tests.
+        * Scripts/webkitpy/port/driver.py:
+        (Driver): Implement generic check_driver method.
+        (Driver.check_driver):
+        (Driver.check_driver.implementation):
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort._driver_class): Check for environment variable
+        USE_NATIVE_XDISPLAY to decide if the Xorg driver should be used.
+        * Scripts/webkitpy/port/xorgdriver.py: Added.
+        (XorgDriver): Implement Xorg driver.
+        (XorgDriver.check_driver):
+        (XorgDriver._start):
+
+2014-05-26  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
+
</ins><span class="cx">         REGRESSION(r166798): [GTK] [EFL] kill-old-processes should not kill dbus-daemon
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=133215
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyperformance_testsperftestsrunnerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (169343 => 169344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py        2014-05-26 14:16:05 UTC (rev 169343)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py        2014-05-26 14:19:51 UTC (rev 169344)
</span><span class="lines">@@ -178,6 +178,12 @@
</span><span class="cx">             _log.error(&quot;Build not up to date for %s&quot; % self._port._path_to_driver())
</span><span class="cx">             return self.EXIT_CODE_BAD_BUILD
</span><span class="cx"> 
</span><ins>+        # Check that the system dependencies (themes, fonts, ...) are correct.
+        if not self._port.check_sys_deps(needs_http=False):
+            _log.error(&quot;Failed to check system dependencies.&quot;)
+            self._port.stop_helper()
+            return self.EXIT_CODE_BAD_PREPARATION
+
</ins><span class="cx">         run_count = 0
</span><span class="cx">         repeat = self._options.repeat
</span><span class="cx">         while (run_count &lt; repeat):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (169343 => 169344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2014-05-26 14:16:05 UTC (rev 169343)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2014-05-26 14:19:51 UTC (rev 169344)
</span><span class="lines">@@ -489,7 +489,13 @@
</span><span class="cx">         block.decode_content()
</span><span class="cx">         return block
</span><span class="cx"> 
</span><ins>+    @staticmethod
+    def check_driver(port):
+        # This checks if the required system dependencies for the driver are met.
+        # Since this is the generic class implementation, just return True.
+        return True
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class ContentBlock(object):
</span><span class="cx">     def __init__(self):
</span><span class="cx">         self.content_type = None
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportgtkpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (169343 => 169344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/gtk.py        2014-05-26 14:16:05 UTC (rev 169343)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py        2014-05-26 14:19:51 UTC (rev 169344)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> from webkitpy.port.pulseaudio_sanitizer import PulseAudioSanitizer
</span><span class="cx"> from webkitpy.port.xvfbdriver import XvfbDriver
</span><span class="cx"> from webkitpy.port.westondriver import WestonDriver
</span><ins>+from webkitpy.port.xorgdriver import XorgDriver
</ins><span class="cx"> from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
</span><span class="cx"> from webkitpy.port.leakdetector_valgrind import LeakDetectorValgrind
</span><span class="cx"> 
</span><span class="lines">@@ -69,6 +70,8 @@
</span><span class="cx">     def _driver_class(self):
</span><span class="cx">         if os.environ.get(&quot;WAYLAND_DISPLAY&quot;):
</span><span class="cx">             return WestonDriver
</span><ins>+        if os.environ.get(&quot;USE_NATIVE_XDISPLAY&quot;):
+            return XorgDriver
</ins><span class="cx">         return XvfbDriver
</span><span class="cx"> 
</span><span class="cx">     def default_timeout_ms(self):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportxorgdriverpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/port/xorgdriver.py (0 => 169344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/xorgdriver.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/xorgdriver.py        2014-05-26 14:19:51 UTC (rev 169344)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+# Copyright (C) 2014 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
+# &quot;AS IS&quot; 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 XorgDriver(Driver):
+    @staticmethod
+    def check_driver(port):
+        if &quot;DISPLAY&quot; not in os.environ:
+                _log.error(&quot;DISPLAY not found in the environment. Cannot run tests.&quot;)
+                return False
+        return True
+
+    def _start(self, pixel_tests, per_test_args):
+        super(XorgDriver, self).stop()
+
+        server_name = self._port.driver_name()
+        self._driver_tempdir = self._port.host.filesystem.mkdtemp(prefix='%s-' % server_name)
+
+        # setup_environ_for_server() already takes care of copying the
+        # XAUTHORITY environment variable
+        server_environment = self._port.setup_environ_for_server(server_name)
+        server_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
+        server_environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
+        # Currently on WebKit2, there is no API for setting the application
+        # cache directory. Each worker should have it's own and it should be
+        # cleaned afterwards, so we set it to inside the temporary folder by
+        # prepending XDG_CACHE_HOME with DUMPRENDERTREE_TEMP.
+        server_environment['XDG_CACHE_HOME'] = self._port.host.filesystem.join(str(self._driver_tempdir), 'appcache')
+
+        self._crashed_process_name = None
+        self._crashed_pid = None
+        self._server_process = self._port._server_process_constructor(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), server_environment)
+        self._server_process.start()
</ins></span></pre>
</div>
</div>

</body>
</html>