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

Unified Diff: net/tools/testserver/testserver.py

Issue 3368012: Wait on a pipe for the test server to start up (Closed)
Patch Set: Sigh. Rebase onto trunk. Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/test/test_server_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 8a864a86cc52113937581d4770b021b0495f3511..ee2476c1b80518798966595a7265b9ff04ea299a 100644
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -39,6 +39,9 @@ except ImportError:
import md5
_new_md5 = md5.new
+if sys.platform == 'win32':
+ import msvcrt
+
SERVER_HTTP = 0
SERVER_FTP = 1
@@ -1230,6 +1233,17 @@ def main(options, args):
server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler)
print 'FTP server started on port %d...' % port
+ # Notify the parent that we've started. (BaseServer subclasses
+ # bind their sockets on construction.)
+ if options.startup_pipe is not None:
+ if sys.platform == 'win32':
+ fd = msvcrt.open_osfhandle(options.startup_pipe, 0)
+ else:
+ fd = options.startup_pipe
+ startup_pipe = os.fdopen(fd, "w")
+ startup_pipe.write("READY")
+ startup_pipe.close()
+
try:
server.serve_forever()
except KeyboardInterrupt:
@@ -1263,6 +1277,9 @@ if __name__ == '__main__':
help='Prevent the server from dying when visiting '
'a /kill URL. Useful for manually running some '
'tests.')
+ option_parser.add_option('', '--startup-pipe', type='int',
+ dest='startup_pipe',
+ help='File handle of pipe to parent process')
options, args = option_parser.parse_args()
sys.exit(main(options, args))
« no previous file with comments | « net/test/test_server_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698