| OLD | NEW | 
|---|
| 1 #!/bin/env python | 1 #!/bin/env python | 
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 """A class to help start/stop the lighttpd server used by layout tests.""" | 6 """A class to help start/stop the lighttpd server used by layout tests.""" | 
| 7 | 7 | 
| 8 | 8 | 
| 9 import logging | 9 import logging | 
| 10 import optparse | 10 import optparse | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 120     start_cmd = [ executable, | 120     start_cmd = [ executable, | 
| 121                   # Newly written config file | 121                   # Newly written config file | 
| 122                   '-f', PathFromBase(self._output_dir, 'lighttpd.conf'), | 122                   '-f', PathFromBase(self._output_dir, 'lighttpd.conf'), | 
| 123                   # Where it can find its module dynamic libraries | 123                   # Where it can find its module dynamic libraries | 
| 124                   '-m', module_path, | 124                   '-m', module_path, | 
| 125                   # Don't background | 125                   # Don't background | 
| 126                   '-D' ] | 126                   '-D' ] | 
| 127 | 127 | 
| 128     # Put the cygwin directory first in the path to find cygwin1.dll | 128     # Put the cygwin directory first in the path to find cygwin1.dll | 
| 129     env = os.environ | 129     env = os.environ | 
| 130     env['PATH'] = '%s;%s' % ( | 130     if sys.platform in ('cygwin', 'win32'): | 
| 131         PathFromBase('third_party', 'cygwin', 'bin'), env['PATH']) | 131       env['PATH'] = '%s;%s' % ( | 
|  | 132           PathFromBase('third_party', 'cygwin', 'bin'), env['PATH']) | 
| 132 | 133 | 
| 133     logging.info('Starting http server') | 134     logging.info('Starting http server') | 
| 134     self._process = subprocess.Popen(start_cmd, env=env) | 135     self._process = subprocess.Popen(start_cmd, env=env) | 
| 135 | 136 | 
| 136     # Ensure that the server is running on all the desired ports. | 137     # Ensure that the server is running on all the desired ports. | 
| 137     for mapping in mappings: | 138     for mapping in mappings: | 
| 138       url = 'http%s://127.0.0.1:%d/' % ('sslcert' in mapping and 's' or '', | 139       url = 'http%s://127.0.0.1:%d/' % ('sslcert' in mapping and 's' or '', | 
| 139                                         mapping['port']) | 140                                         mapping['port']) | 
| 140       if not self._UrlIsAlive(url): | 141       if not self._UrlIsAlive(url): | 
| 141         raise HttpdNotStarted('Failed to start httpd on port %s' % | 142         raise HttpdNotStarted('Failed to start httpd on port %s' % | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203     print "Usage: %s --server {start|stop} [--apache2]" % sys.argv[0] | 204     print "Usage: %s --server {start|stop} [--apache2]" % sys.argv[0] | 
| 204   else: | 205   else: | 
| 205     if (options.root is None) != (options.port is None): | 206     if (options.root is None) != (options.port is None): | 
| 206       raise 'Either port or root is missing (need both, or neither)' | 207       raise 'Either port or root is missing (need both, or neither)' | 
| 207     httpd = Lighttpd('c:/cygwin/tmp', port=options.port, root=options.root) | 208     httpd = Lighttpd('c:/cygwin/tmp', port=options.port, root=options.root) | 
| 208   if 'start' == options.server: | 209   if 'start' == options.server: | 
| 209     httpd.Start() | 210     httpd.Start() | 
| 210   else: | 211   else: | 
| 211     httpd.Stop(force=True) | 212     httpd.Stop(force=True) | 
| 212 | 213 | 
| OLD | NEW | 
|---|