<!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>[196778] 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/196778">196778</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2016-02-18 14:31:49 -0800 (Thu, 18 Feb 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>run-webkit-httpd should use webkitpy to run httpd.
https://bugs.webkit.org/show_bug.cgi?id=154271
Reviewed by Alexey Proskuryakov.
Update run-webkit-httpd to use webkitpy.port to launch httpd. Pass on http_port and http_all_interface
options to match the current run-webkit-httpd (optional) behavior.
* Scripts/run-webkit-httpd:
(parse_args):
(main):
* Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
(LayoutTestApacheHttpd.__init__):
* Scripts/webkitpy/layout_tests/servers/http_server.py:
(Lighttpd._prepare_config):
* Scripts/webkitpy/port/base.py:
(Port.to.start_http_server):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrunwebkithttpd">trunk/Tools/Scripts/run-webkit-httpd</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsserversapache_http_serverpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsservershttp_serverpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportbasepy">trunk/Tools/Scripts/webkitpy/port/base.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (196777 => 196778)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-02-18 21:58:15 UTC (rev 196777)
+++ trunk/Tools/ChangeLog        2016-02-18 22:31:49 UTC (rev 196778)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-02-18 Jer Noble <jer.noble@apple.com>
+
+ run-webkit-httpd should use webkitpy to run httpd.
+ https://bugs.webkit.org/show_bug.cgi?id=154271
+
+ Reviewed by Alexey Proskuryakov.
+
+ Update run-webkit-httpd to use webkitpy.port to launch httpd. Pass on http_port and http_all_interface
+ options to match the current run-webkit-httpd (optional) behavior.
+
+ * Scripts/run-webkit-httpd:
+ (parse_args):
+ (main):
+ * Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
+ (LayoutTestApacheHttpd.__init__):
+ * Scripts/webkitpy/layout_tests/servers/http_server.py:
+ (Lighttpd._prepare_config):
+ * Scripts/webkitpy/port/base.py:
+ (Port.to.start_http_server):
+
</ins><span class="cx"> 2016-02-18 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove remaining references to LLVM, and make sure comments refer to the backend as "B3" not "LLVM"
</span></span></pre></div>
<a id="trunkToolsScriptsrunwebkithttpd"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-webkit-httpd (196777 => 196778)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-webkit-httpd        2016-02-18 21:58:15 UTC (rev 196777)
+++ trunk/Tools/Scripts/run-webkit-httpd        2016-02-18 22:31:49 UTC (rev 196778)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-#!/usr/bin/perl
</del><ins>+#!/usr/bin/python
</ins><span class="cx">
</span><span class="cx"> # Copyright (C) 2005, 2006, 2007, 2015 Apple Inc. All rights reserved.
</span><span class="cx"> # Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
</span><span class="lines">@@ -28,73 +28,51 @@
</span><span class="cx"> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
</span><span class="cx"> # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><del>-# Script to run Apache with the same configuration as used in http layout tests.
</del><ins>+import optparse
+import subprocess
+import sys
+import tempfile
+import time
</ins><span class="cx">
</span><del>-use strict;
-use warnings;
</del><ins>+from webkitpy.common.host import Host
+from webkitpy.port import platform_options
</ins><span class="cx">
</span><del>-use Cwd;
-use File::Path;
-use File::Basename;
-use Getopt::Long;
-use FindBin;
</del><ins>+def parse_args(args):
+ parser = optparse.OptionParser()
+ parser.add_option("-a", "--all-interfaces", help="Bind to all interfaces", action="store_true", dest="http_all_interfaces")
+ parser.add_option("-p", "--port", help="Bind to port NNNN", action="store", type="int", dest="http_port")
+ return parser.parse_args(args)
</ins><span class="cx">
</span><del>-use lib $FindBin::Bin;
-use webkitperl::httpd;
-use webkitdirs;
</del><ins>+def main(argv, stdout, stderr):
+ options, args = parse_args(argv)
+ host = Host()
</ins><span class="cx">
</span><del>-# FIXME: Dynamic HTTP-port configuration in this file is wrong. The various
-# apache config files in LayoutTests/http/config govern the port numbers.
-# Dynamic configuration as-written will also cause random failures in
-# an IPv6 environment. See https://bugs.webkit.org/show_bug.cgi?id=37104.
-# Argument handling
-my $httpdPort = 8000;
-my $allInterfaces = 0;
-my $showHelp;
</del><ins>+ log_file = tempfile.NamedTemporaryFile()
+ options.http_access_log = log_file.name
+ options.http_error_log = log_file.name
+ options.platform = None
</ins><span class="cx">
</span><del>-my $result = GetOptions(
- 'all-interfaces|a' => \$allInterfaces,
- 'help|h' => \$showHelp,
- 'port=i' => \$httpdPort,
-);
</del><ins>+ try:
+ port = host.port_factory.get(options.platform, options)
+ except NotImplementedError, e:
+ print >> stderr, str(e)
+ return EXCEPTIONAL_EXIT_STATUS
</ins><span class="cx">
</span><del>-if (!$result || @ARGV || $showHelp) {
- print "Usage: " . basename($0) . " [options]\n";
- print " -a|--all-interfaces Bind to all interfaces\n";
- print " -h|--help Show this help message\n";
- print " -p|--port NNNN Bind to port NNNN\n";
- exit 1;
-}
</del><ins>+ # FIXME(154294): somehow retrieve the actual ports and interfaces bound by the httpd server
+ http_port = options.http_port if options.http_port is not None else "8000"
+ if options.http_all_interfaces is not None:
+ print "Starting httpd on port %s (all interfaces)" % http_port
+ else:
+ print "Starting httpd on <http://127.0.0.1:%s>" % http_port
</ins><span class="cx">
</span><del>-setConfiguration();
-my $productDir = productDir();
-chdirWebKit();
-my $testDirectory = File::Spec->catfile(getcwd(), "LayoutTests");
-my $listen = "127.0.0.1:$httpdPort";
-$listen = "$httpdPort" if ($allInterfaces);
</del><ins>+ port.start_http_server()
</ins><span class="cx">
</span><del>-if ($allInterfaces) {
- print "Starting httpd on port $httpdPort (all interfaces)...\n";
-} else {
- print "Starting httpd on <http://$listen/>...\n";
-}
-setShouldWaitForUserInterrupt();
-print "Press Ctrl+C to stop it.\n\n";
</del><ins>+ try:
+ tail = subprocess.Popen(['tail', '-F', log_file.name], stdout=subprocess.PIPE)
+ while True:
+ sys.stdout.write(tail.stdout.readline())
+ except KeyboardInterrupt:
+ port.stop_http_server()
</ins><span class="cx">
</span><del>-my @args = (
- "-C", "Listen $listen",
- # Run in single-process mode, do not detach from the controlling terminal.
- "-X",
- # Disable Keep-Alive support. Makes testing in multiple browsers easier (no need to wait
- # for another browser's connection to expire).
- "-c", "KeepAlive off"
-);
-
-if (!isAnyWindows()) {
- push(@args, "-c", "CustomLog |/usr/bin/tee common");
- push(@args, "-c", "ErrorLog |/usr/bin/tee");
-}
-
-my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory);
-@args = (@defaultArgs, @args);
-openHTTPD(@args);
</del><ins>+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr))
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsserversapache_http_serverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py (196777 => 196778)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py        2016-02-18 21:58:15 UTC (rev 196777)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py        2016-02-18 22:31:49 UTC (rev 196778)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> class LayoutTestApacheHttpd(http_server_base.HttpServerBase):
</span><del>- def __init__(self, port_obj, output_dir, additional_dirs=None):
</del><ins>+ def __init__(self, port_obj, output_dir, additional_dirs=None, port=None):
</ins><span class="cx"> """Args:
</span><span class="cx"> port_obj: handle to the platform-specific routines
</span><span class="cx"> output_dir: the absolute path to the layout test result directory
</span><span class="lines">@@ -51,10 +51,15 @@
</span><span class="cx"> http_server_base.HttpServerBase.__init__(self, port_obj)
</span><span class="cx"> # We use the name "httpd" instead of "apache" to make our paths (e.g. the pid file: /tmp/WebKit/httpd.pid)
</span><span class="cx"> # match old-run-webkit-tests: https://bugs.webkit.org/show_bug.cgi?id=63956
</span><ins>+
</ins><span class="cx"> self._name = 'httpd'
</span><del>- self._mappings = [{'port': 8000},
- {'port': 8080},
- {'port': 8443, 'sslcert': True}]
</del><ins>+ self._port = port
+ if self._port is not None:
+ self._mappings = [{'port': self._port}]
+ else:
+ self._mappings = [{'port': 8000},
+ {'port': 8080},
+ {'port': 8443, 'sslcert': True}]
</ins><span class="cx"> self._output_dir = output_dir
</span><span class="cx"> self._filesystem.maybe_make_directory(output_dir)
</span><span class="cx">
</span><span class="lines">@@ -80,6 +85,12 @@
</span><span class="cx"> error_log = self._filesystem.join(output_dir, "error_log.txt")
</span><span class="cx"> document_root = self._filesystem.join(test_dir, "http", "tests")
</span><span class="cx">
</span><ins>+ if port_obj.get_option('http_access_log'):
+ access_log = port_obj.get_option('http_access_log')
+
+ if port_obj.get_option('http_error_log'):
+ error_log = port_obj.get_option('http_error_log')
+
</ins><span class="cx"> # FIXME: We shouldn't be calling a protected method of _port_obj!
</span><span class="cx"> executable = self._port_obj._path_to_apache()
</span><span class="cx">
</span><span class="lines">@@ -110,10 +121,12 @@
</span><span class="cx"> except:
</span><span class="cx"> enable_ipv6 = False
</span><span class="cx">
</span><ins>+ bind_address = '' if self._port_obj.get_option("http_all_interfaces") else '127.0.0.1:'
+
</ins><span class="cx"> for mapping in self._mappings:
</span><span class="cx"> port = mapping['port']
</span><span class="cx">
</span><del>- start_cmd += ['-C', "\'Listen 127.0.0.1:%d\'" % port]
</del><ins>+ start_cmd += ['-C', "\'Listen %s%d\'" % (bind_address, port)]
</ins><span class="cx">
</span><span class="cx"> # We listen to both IPv4 and IPv6 loop-back addresses, but ignore
</span><span class="cx"> # requests to 8000 from random users on network.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsservershttp_serverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py (196777 => 196778)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py        2016-02-18 21:58:15 UTC (rev 196777)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py        2016-02-18 22:31:49 UTC (rev 196778)
</span><span class="lines">@@ -94,6 +94,12 @@
</span><span class="cx"> log_file_name = "error.log-" + time_str + ".txt"
</span><span class="cx"> error_log = os.path.join(self._output_dir, log_file_name)
</span><span class="cx">
</span><ins>+ if self._port_obj.get_option('http_access_log'):
+ access_log = self._port_obj.get_option('http_access_log')
+
+ if self._port_obj.get_option('http_error_log'):
+ error_log = self._port_obj.get_option('http_error_log')
+
</ins><span class="cx"> # Write out the config
</span><span class="cx"> base_conf = self._filesystem.read_text_file(base_conf_file)
</span><span class="cx">
</span><span class="lines">@@ -149,16 +155,18 @@
</span><span class="cx"> 'sslcert': self._pem_file}]
</span><span class="cx"> else:
</span><span class="cx"> mappings = self.VIRTUALCONFIG
</span><ins>+
+ bind_address = '' if self._port_obj.get_option('http_all_addresses') else '127.0.0.1'
</ins><span class="cx"> for mapping in mappings:
</span><span class="cx"> ssl_setup = ''
</span><span class="cx"> if 'sslcert' in mapping:
</span><span class="cx"> ssl_setup = (' ssl.engine = "enable"\n'
</span><span class="cx"> ' ssl.pemfile = "%s"\n' % mapping['sslcert'])
</span><span class="cx">
</span><del>- f.write(('$SERVER["socket"] == "127.0.0.1:%d" {\n'
</del><ins>+ f.write(('$SERVER["socket"] == "%s:%d" {\n'
</ins><span class="cx"> ' server.document-root = "%s"\n' +
</span><span class="cx"> ssl_setup +
</span><del>- '}\n\n') % (mapping['port'], mapping['docroot']))
</del><ins>+ '}\n\n') % (bind_address, mapping['port'], mapping['docroot']))
</ins><span class="cx"> f.close()
</span><span class="cx">
</span><span class="cx"> executable = self._port_obj._path_to_lighttpd()
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportbasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/base.py (196777 => 196778)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/base.py        2016-02-18 21:58:15 UTC (rev 196777)
+++ trunk/Tools/Scripts/webkitpy/port/base.py        2016-02-18 22:31:49 UTC (rev 196778)
</span><span class="lines">@@ -905,11 +905,11 @@
</span><span class="cx">
</span><span class="cx"> Ports can stub this out if they don't need a web server to be running."""
</span><span class="cx"> assert not self._http_server, 'Already running an http server.'
</span><del>-
</del><ins>+ http_port = self.get_option('http_port')
</ins><span class="cx"> if self._uses_apache():
</span><del>- server = apache_http_server.LayoutTestApacheHttpd(self, self.results_directory(), additional_dirs=additional_dirs)
</del><ins>+ server = apache_http_server.LayoutTestApacheHttpd(self, self.results_directory(), additional_dirs=additional_dirs, port=http_port)
</ins><span class="cx"> else:
</span><del>- server = http_server.Lighttpd(self, self.results_directory(), additional_dirs=additional_dirs)
</del><ins>+ server = http_server.Lighttpd(self, self.results_directory(), additional_dirs=additional_dirs, port=http_port)
</ins><span class="cx">
</span><span class="cx"> server.start()
</span><span class="cx"> self._http_server = server
</span></span></pre>
</div>
</div>
</body>
</html>