Robustness work for port_server startup
diff --git a/tools/run_tests/port_server.py b/tools/run_tests/port_server.py
index b953df9..4e473af 100755
--- a/tools/run_tests/port_server.py
+++ b/tools/run_tests/port_server.py
@@ -42,7 +42,7 @@
# increment this number whenever making a change to ensure that
# the changes are picked up by running CI servers
# note that all changes must be backwards compatible
-_MY_VERSION = 2
+_MY_VERSION = 4
if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
@@ -52,8 +52,13 @@
argp = argparse.ArgumentParser(description='Server for httpcli_test')
argp.add_argument('-p', '--port', default=12345, type=int)
+argp.add_argument('-l', '--logfile', default=None, type=str)
args = argp.parse_args()
+if args.logfile is not None:
+ sys.stderr = open(args.logfile, 'w')
+ sys.stdout = sys.stderr
+
print 'port server running on port %d' % args.port
pool = []
@@ -146,6 +151,6 @@
httpd = BaseHTTPServer.HTTPServer(('', args.port), Handler)
while keep_running:
httpd.handle_request()
+ sys.stderr.flush()
print 'done'
-