Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: webkit/tools/layout_tests/layout_package/http_server.py

Issue 257047: Fix bug 23303: ui_tests crash Windows 7's shell when running WorkerHttpLayout... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« chrome/test/ui/ui_test.cc ('K') | « chrome/test/ui/ui_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if _pending_tests: 77 if _pending_tests:
78 VIRTUALCONFIG.extend( 78 VIRTUALCONFIG.extend(
79 # Three similar mappings (one with SSL enabled) for pending http tests 79 # Three similar mappings (one with SSL enabled) for pending http tests
80 [{'port': 9000, 'docroot': _pending_tests}, 80 [{'port': 9000, 'docroot': _pending_tests},
81 {'port': 9080, 'docroot': _pending_tests}, 81 {'port': 9080, 'docroot': _pending_tests},
82 {'port': 9443, 'docroot': _pending_tests, 'sslcert': _pem_file}] 82 {'port': 9443, 'docroot': _pending_tests, 'sslcert': _pem_file}]
83 ) 83 )
84 84
85 85
86 def __init__(self, output_dir, background=False, port=None, root=None, 86 def __init__(self, output_dir, background=False, port=None, root=None,
87 register_cygwin=None): 87 register_cygwin=None, run_background=None):
88 """Args: 88 """Args:
89 output_dir: the absolute path to the layout test result directory 89 output_dir: the absolute path to the layout test result directory
90 """ 90 """
91 self._output_dir = output_dir 91 self._output_dir = output_dir
92 self._process = None 92 self._process = None
93 self._port = port 93 self._port = port
94 self._root = root 94 self._root = root
95 self._register_cygwin = register_cygwin 95 self._register_cygwin = register_cygwin
96 self._run_background = run_background
96 if self._port: 97 if self._port:
97 self._port = int(self._port) 98 self._port = int(self._port)
98 99
99 def IsRunning(self): 100 def IsRunning(self):
100 return self._process != None 101 return self._process != None
101 102
102 def Start(self): 103 def Start(self):
103 if self.IsRunning(): 104 if self.IsRunning():
104 raise 'Lighttpd already running' 105 raise 'Lighttpd already running'
105 106
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 '}\n\n') % (mapping['port'], mapping['docroot'])) 175 '}\n\n') % (mapping['port'], mapping['docroot']))
175 f.close() 176 f.close()
176 177
177 executable = path_utils.LigHTTPdExecutablePath() 178 executable = path_utils.LigHTTPdExecutablePath()
178 module_path = path_utils.LigHTTPdModulePath() 179 module_path = path_utils.LigHTTPdModulePath()
179 start_cmd = [ executable, 180 start_cmd = [ executable,
180 # Newly written config file 181 # Newly written config file
181 '-f', path_utils.PathFromBase(self._output_dir, 182 '-f', path_utils.PathFromBase(self._output_dir,
182 'lighttpd.conf'), 183 'lighttpd.conf'),
183 # Where it can find its module dynamic libraries 184 # Where it can find its module dynamic libraries
184 '-m', module_path, 185 '-m', module_path ]
185 # Don't background 186
186 '-D' ] 187 if not self._run_background:
188 start_cmd.append(# Don't background
189 '-D')
187 190
188 # Copy liblightcomp.dylib to /tmp/lighttpd/lib to work around the bug that 191 # Copy liblightcomp.dylib to /tmp/lighttpd/lib to work around the bug that
189 # mod_alias.so loads it from the hard coded path. 192 # mod_alias.so loads it from the hard coded path.
190 if sys.platform == 'darwin': 193 if sys.platform == 'darwin':
191 tmp_module_path = '/tmp/lighttpd/lib' 194 tmp_module_path = '/tmp/lighttpd/lib'
192 if not os.path.exists(tmp_module_path): 195 if not os.path.exists(tmp_module_path):
193 os.makedirs(tmp_module_path) 196 os.makedirs(tmp_module_path)
194 lib_file = 'liblightcomp.dylib' 197 lib_file = 'liblightcomp.dylib'
195 shutil.copyfile(os.path.join(module_path, lib_file), 198 shutil.copyfile(os.path.join(module_path, lib_file),
196 os.path.join(tmp_module_path, lib_file)) 199 os.path.join(tmp_module_path, lib_file))
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 # Provide some command line params for starting/stopping the http server 274 # Provide some command line params for starting/stopping the http server
272 # manually. Also used in ui_tests to run http layout tests in a browser. 275 # manually. Also used in ui_tests to run http layout tests in a browser.
273 option_parser = optparse.OptionParser() 276 option_parser = optparse.OptionParser()
274 option_parser.add_option('-k', '--server', help='Server action (start|stop)') 277 option_parser.add_option('-k', '--server', help='Server action (start|stop)')
275 option_parser.add_option('-p', '--port', 278 option_parser.add_option('-p', '--port',
276 help='Port to listen on (overrides layout test ports)') 279 help='Port to listen on (overrides layout test ports)')
277 option_parser.add_option('-r', '--root', 280 option_parser.add_option('-r', '--root',
278 help='Absolute path to DocumentRoot (overrides layout test roots)') 281 help='Absolute path to DocumentRoot (overrides layout test roots)')
279 option_parser.add_option('--register_cygwin', action="store_true", 282 option_parser.add_option('--register_cygwin', action="store_true",
280 dest="register_cygwin", help='Register Cygwin paths (on Win try bots)') 283 dest="register_cygwin", help='Register Cygwin paths (on Win try bots)')
284 option_parser.add_option('--run_background', action="store_true",
285 dest="run_background", help='Run on background (for running as UI test)')
281 options, args = option_parser.parse_args() 286 options, args = option_parser.parse_args()
282 287
283 if not options.server: 288 if not options.server:
284 print 'Usage: %s --server {start|stop} [--root=root_dir]' 289 print 'Usage: %s --server {start|stop} [--root=root_dir]'
285 print ' [--port=port_number]' % sys.argv[0] 290 print ' [--port=port_number]' % sys.argv[0]
286 else: 291 else:
287 if (options.root is None) and (options.port is not None): 292 if (options.root is None) and (options.port is not None):
288 # specifying root but not port means we want httpd on default set of 293 # specifying root but not port means we want httpd on default set of
289 # ports that LayoutTest use, but pointing to a different source of tests. 294 # ports that LayoutTest use, but pointing to a different source of tests.
290 # Specifying port but no root does not seem meaningful. 295 # Specifying port but no root does not seem meaningful.
291 raise 'Specifying port requires also a root.' 296 raise 'Specifying port requires also a root.'
292 httpd = Lighttpd(tempfile.gettempdir(), 297 httpd = Lighttpd(tempfile.gettempdir(),
293 port=options.port, 298 port=options.port,
294 root=options.root, 299 root=options.root,
295 register_cygwin=options.register_cygwin) 300 register_cygwin=options.register_cygwin,
301 run_background=options.run_background)
296 if 'start' == options.server: 302 if 'start' == options.server:
297 httpd.Start() 303 httpd.Start()
298 else: 304 else:
299 httpd.Stop(force=True) 305 httpd.Stop(force=True)
OLDNEW
« chrome/test/ui/ui_test.cc ('K') | « chrome/test/ui/ui_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698