summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authordavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 18:15:23 +0000
committerdavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 18:15:23 +0000
commit4ce0e74c4378f5421ca3b1a17eeba4b8d42afb34 (patch)
tree4939a16032ef049b86450ace658a32d55dde305f /net/tools
parent9a039afdaf755b7f1468628a5a2c6cfe848ca235 (diff)
downloadchromium_src-4ce0e74c4378f5421ca3b1a17eeba4b8d42afb34.zip
chromium_src-4ce0e74c4378f5421ca3b1a17eeba4b8d42afb34.tar.gz
chromium_src-4ce0e74c4378f5421ca3b1a17eeba4b8d42afb34.tar.bz2
Wait on a pipe for the test server to start up
This should speed up testserver-based unit tests considerably and make them less flakey. R=agl,cpu,phajdan,wtc BUG=49680 TEST=net_unittests Review URL: http://codereview.chromium.org/3368012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/testserver/testserver.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 8a864a8..ee2476c 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))