Changeset 196778 in webkit
- Timestamp:
- Feb 18, 2016, 2:31:49 PM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r196756 r196778 1 2016-02-18 Jer Noble <jer.noble@apple.com> 2 3 run-webkit-httpd should use webkitpy to run httpd. 4 https://bugs.webkit.org/show_bug.cgi?id=154271 5 6 Reviewed by Alexey Proskuryakov. 7 8 Update run-webkit-httpd to use webkitpy.port to launch httpd. Pass on http_port and http_all_interface 9 options to match the current run-webkit-httpd (optional) behavior. 10 11 * Scripts/run-webkit-httpd: 12 (parse_args): 13 (main): 14 * Scripts/webkitpy/layout_tests/servers/apache_http_server.py: 15 (LayoutTestApacheHttpd.__init__): 16 * Scripts/webkitpy/layout_tests/servers/http_server.py: 17 (Lighttpd._prepare_config): 18 * Scripts/webkitpy/port/base.py: 19 (Port.to.start_http_server): 20 1 21 2016-02-18 Filip Pizlo <fpizlo@apple.com> 2 22 -
trunk/Tools/Scripts/run-webkit-httpd
r179405 r196778 1 #!/usr/bin/p erl1 #!/usr/bin/python 2 2 3 3 # Copyright (C) 2005, 2006, 2007, 2015 Apple Inc. All rights reserved. … … 29 29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 30 31 # Script to run Apache with the same configuration as used in http layout tests. 31 import optparse 32 import subprocess 33 import sys 34 import tempfile 35 import time 32 36 33 use strict; 34 use warnings; 37 from webkitpy.common.host import Host 38 from webkitpy.port import platform_options 35 39 36 use Cwd; 37 use File::Path; 38 use File::Basename; 39 use Getopt::Long; 40 use FindBin; 40 def parse_args(args): 41 parser = optparse.OptionParser() 42 parser.add_option("-a", "--all-interfaces", help="Bind to all interfaces", action="store_true", dest="http_all_interfaces") 43 parser.add_option("-p", "--port", help="Bind to port NNNN", action="store", type="int", dest="http_port") 44 return parser.parse_args(args) 41 45 42 use lib $FindBin::Bin; 43 use webkitperl::httpd; 44 use webkitdirs; 46 def main(argv, stdout, stderr): 47 options, args = parse_args(argv) 48 host = Host() 45 49 46 # FIXME: Dynamic HTTP-port configuration in this file is wrong. The various 47 # apache config files in LayoutTests/http/config govern the port numbers. 48 # Dynamic configuration as-written will also cause random failures in 49 # an IPv6 environment. See https://bugs.webkit.org/show_bug.cgi?id=37104. 50 # Argument handling 51 my $httpdPort = 8000; 52 my $allInterfaces = 0; 53 my $showHelp; 50 log_file = tempfile.NamedTemporaryFile() 51 options.http_access_log = log_file.name 52 options.http_error_log = log_file.name 53 options.platform = None 54 54 55 my $result = GetOptions( 56 'all-interfaces|a' => \$allInterfaces,57 'help|h' => \$showHelp,58 'port=i' => \$httpdPort,59 ); 55 try: 56 port = host.port_factory.get(options.platform, options) 57 except NotImplementedError, e: 58 print >> stderr, str(e) 59 return EXCEPTIONAL_EXIT_STATUS 60 60 61 if (!$result || @ARGV || $showHelp) { 62 print "Usage: " . basename($0) . " [options]\n"; 63 print " -a|--all-interfaces Bind to all interfaces\n"; 64 print " -h|--help Show this help message\n"; 65 print " -p|--port NNNN Bind to port NNNN\n"; 66 exit 1; 67 } 61 # FIXME(154294): somehow retrieve the actual ports and interfaces bound by the httpd server 62 http_port = options.http_port if options.http_port is not None else "8000" 63 if options.http_all_interfaces is not None: 64 print "Starting httpd on port %s (all interfaces)" % http_port 65 else: 66 print "Starting httpd on <http://127.0.0.1:%s>" % http_port 68 67 69 setConfiguration(); 70 my $productDir = productDir(); 71 chdirWebKit(); 72 my $testDirectory = File::Spec->catfile(getcwd(), "LayoutTests"); 73 my $listen = "127.0.0.1:$httpdPort"; 74 $listen = "$httpdPort" if ($allInterfaces); 68 port.start_http_server() 75 69 76 if ($allInterfaces) { 77 print "Starting httpd on port $httpdPort (all interfaces)...\n"; 78 } else { 79 print "Starting httpd on <http://$listen/>...\n"; 80 } 81 setShouldWaitForUserInterrupt(); 82 print "Press Ctrl+C to stop it.\n\n"; 70 try: 71 tail = subprocess.Popen(['tail', '-F', log_file.name], stdout=subprocess.PIPE) 72 while True: 73 sys.stdout.write(tail.stdout.readline()) 74 except KeyboardInterrupt: 75 port.stop_http_server() 83 76 84 my @args = ( 85 "-C", "Listen $listen", 86 # Run in single-process mode, do not detach from the controlling terminal. 87 "-X", 88 # Disable Keep-Alive support. Makes testing in multiple browsers easier (no need to wait 89 # for another browser's connection to expire). 90 "-c", "KeepAlive off" 91 ); 92 93 if (!isAnyWindows()) { 94 push(@args, "-c", "CustomLog |/usr/bin/tee common"); 95 push(@args, "-c", "ErrorLog |/usr/bin/tee"); 96 } 97 98 my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory); 99 @args = (@defaultArgs, @args); 100 openHTTPD(@args); 77 if __name__ == '__main__': 78 sys.exit(main(sys.argv[1:], sys.stdout, sys.stderr)) -
trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py
r192944 r196778 44 44 45 45 class LayoutTestApacheHttpd(http_server_base.HttpServerBase): 46 def __init__(self, port_obj, output_dir, additional_dirs=None ):46 def __init__(self, port_obj, output_dir, additional_dirs=None, port=None): 47 47 """Args: 48 48 port_obj: handle to the platform-specific routines … … 52 52 # We use the name "httpd" instead of "apache" to make our paths (e.g. the pid file: /tmp/WebKit/httpd.pid) 53 53 # match old-run-webkit-tests: https://bugs.webkit.org/show_bug.cgi?id=63956 54 54 55 self._name = 'httpd' 55 self._mappings = [{'port': 8000}, 56 {'port': 8080}, 57 {'port': 8443, 'sslcert': True}] 56 self._port = port 57 if self._port is not None: 58 self._mappings = [{'port': self._port}] 59 else: 60 self._mappings = [{'port': 8000}, 61 {'port': 8080}, 62 {'port': 8443, 'sslcert': True}] 58 63 self._output_dir = output_dir 59 64 self._filesystem.maybe_make_directory(output_dir) … … 80 85 error_log = self._filesystem.join(output_dir, "error_log.txt") 81 86 document_root = self._filesystem.join(test_dir, "http", "tests") 87 88 if port_obj.get_option('http_access_log'): 89 access_log = port_obj.get_option('http_access_log') 90 91 if port_obj.get_option('http_error_log'): 92 error_log = port_obj.get_option('http_error_log') 82 93 83 94 # FIXME: We shouldn't be calling a protected method of _port_obj! … … 111 122 enable_ipv6 = False 112 123 124 bind_address = '' if self._port_obj.get_option("http_all_interfaces") else '127.0.0.1:' 125 113 126 for mapping in self._mappings: 114 127 port = mapping['port'] 115 128 116 start_cmd += ['-C', "\'Listen 127.0.0.1:%d\'" % port]129 start_cmd += ['-C', "\'Listen %s%d\'" % (bind_address, port)] 117 130 118 131 # We listen to both IPv4 and IPv6 loop-back addresses, but ignore -
trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server.py
r176830 r196778 95 95 error_log = os.path.join(self._output_dir, log_file_name) 96 96 97 if self._port_obj.get_option('http_access_log'): 98 access_log = self._port_obj.get_option('http_access_log') 99 100 if self._port_obj.get_option('http_error_log'): 101 error_log = self._port_obj.get_option('http_error_log') 102 97 103 # Write out the config 98 104 base_conf = self._filesystem.read_text_file(base_conf_file) … … 150 156 else: 151 157 mappings = self.VIRTUALCONFIG 158 159 bind_address = '' if self._port_obj.get_option('http_all_addresses') else '127.0.0.1' 152 160 for mapping in mappings: 153 161 ssl_setup = '' … … 156 164 ' ssl.pemfile = "%s"\n' % mapping['sslcert']) 157 165 158 f.write(('$SERVER["socket"] == " 127.0.0.1:%d" {\n'166 f.write(('$SERVER["socket"] == "%s:%d" {\n' 159 167 ' server.document-root = "%s"\n' + 160 168 ssl_setup + 161 '}\n\n') % ( mapping['port'], mapping['docroot']))169 '}\n\n') % (bind_address, mapping['port'], mapping['docroot'])) 162 170 f.close() 163 171 -
trunk/Tools/Scripts/webkitpy/port/base.py
r194761 r196778 906 906 Ports can stub this out if they don't need a web server to be running.""" 907 907 assert not self._http_server, 'Already running an http server.' 908 908 http_port = self.get_option('http_port') 909 909 if self._uses_apache(): 910 server = apache_http_server.LayoutTestApacheHttpd(self, self.results_directory(), additional_dirs=additional_dirs )910 server = apache_http_server.LayoutTestApacheHttpd(self, self.results_directory(), additional_dirs=additional_dirs, port=http_port) 911 911 else: 912 server = http_server.Lighttpd(self, self.results_directory(), additional_dirs=additional_dirs )912 server = http_server.Lighttpd(self, self.results_directory(), additional_dirs=additional_dirs, port=http_port) 913 913 914 914 server.start()
Note:
See TracChangeset
for help on using the changeset viewer.