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

Side by Side Diff: build/android/lighttpd_server.py

Issue 11183025: Use third_party/pexpect in android pylib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak Created 8 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
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | 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 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provides a convenient wrapper for spawning a test lighttpd instance. 7 """Provides a convenient wrapper for spawning a test lighttpd instance.
8 8
9 Usage: 9 Usage:
10 lighttpd_server PATH_TO_DOC_ROOT 10 lighttpd_server PATH_TO_DOC_ROOT
11 """ 11 """
12 12
13 import codecs 13 import codecs
14 import contextlib 14 import contextlib
15 import httplib 15 import httplib
16 import os 16 import os
17 import pexpect
18 import random 17 import random
19 import shutil 18 import shutil
20 import socket 19 import socket
21 import subprocess 20 import subprocess
22 import sys 21 import sys
23 import tempfile 22 import tempfile
24 import time 23 import time
25 24
26 from pylib import constants 25 from pylib import constants
27 26 from pylib import pexpect
28 27
29 class LighttpdServer(object): 28 class LighttpdServer(object):
30 """Wraps lighttpd server, providing robust startup. 29 """Wraps lighttpd server, providing robust startup.
31 30
32 Args: 31 Args:
33 document_root: Path to root of this server's hosted files. 32 document_root: Path to root of this server's hosted files.
34 port: TCP port on the _host_ machine that the server will listen on. If 33 port: TCP port on the _host_ machine that the server will listen on. If
35 ommitted it will attempt to use 9000, or if unavailable it will find 34 ommitted it will attempt to use 9000, or if unavailable it will find
36 a free port from 8001 - 8999. 35 a free port from 8001 - 8999.
37 lighttpd_path, lighttpd_module_path: Optional paths to lighttpd binaries. 36 lighttpd_path, lighttpd_module_path: Optional paths to lighttpd binaries.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 raw_input('Server running at http://127.0.0.1:%s -' 244 raw_input('Server running at http://127.0.0.1:%s -'
246 ' press Enter to exit it.' % server.port) 245 ' press Enter to exit it.' % server.port)
247 else: 246 else:
248 print 'Server exit code:', server.process.exitstatus 247 print 'Server exit code:', server.process.exitstatus
249 finally: 248 finally:
250 server.ShutdownHttpServer() 249 server.ShutdownHttpServer()
251 250
252 251
253 if __name__ == '__main__': 252 if __name__ == '__main__':
254 sys.exit(main(sys.argv)) 253 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698