aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/http2_test
diff options
context:
space:
mode:
authorGravatar Eric Gribkoff <ericgribkoff@google.com>2016-12-16 12:44:31 -0800
committerGravatar GitHub <noreply@github.com>2016-12-16 12:44:31 -0800
commit10639a68ab4fb3622c60cc78094947d3919001e9 (patch)
treea8596327c1a8242fbeb8264532d2cd3a5cfe8a20 /test/http2_test
parent3fab5651dad9fd59319212b65addb8b3f1efb24a (diff)
parentb3bda54df8a89904fb22f55558ec9a43e56ade47 (diff)
Merge pull request #9126 from ericgribkoff/http2_test_case_flags
Modify HTTP/2 test server's command-line arguments
Diffstat (limited to 'test/http2_test')
-rw-r--r--test/http2_test/http2_test_server.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/http2_test/http2_test_server.py b/test/http2_test/http2_test_server.py
index c9b33e00f1..44e36d34b6 100644
--- a/test/http2_test/http2_test_server.py
+++ b/test/http2_test/http2_test_server.py
@@ -73,15 +73,18 @@ class H2Factory(twisted.internet.protocol.Factory):
else:
return t().get_base_server()
-if __name__ == "__main__":
- logging.basicConfig(format = "%(levelname) -10s %(asctime)s %(module)s:%(lineno)s | %(message)s", level=logging.INFO)
+if __name__ == '__main__':
+ logging.basicConfig(
+ format='%(levelname) -10s %(asctime)s %(module)s:%(lineno)s | %(message)s',
+ level=logging.INFO)
parser = argparse.ArgumentParser()
- parser.add_argument("test")
- parser.add_argument("port")
+ parser.add_argument('--test_case', choices=sorted(_TEST_CASE_MAPPING.keys()),
+ help='test case to run', required=True)
+ parser.add_argument('--port', type=int, default=8080,
+ help='port to run the server (default: 8080)')
args = parser.parse_args()
- if args.test not in _TEST_CASE_MAPPING.keys():
- logging.error('unknown test: %s' % args.test)
- else:
- endpoint = twisted.internet.endpoints.TCP4ServerEndpoint(twisted.internet.reactor, int(args.port), backlog=128)
- endpoint.listen(H2Factory(args.test))
- twisted.internet.reactor.run()
+ logging.info('Running test case %s on port %d' % (args.test_case, args.port))
+ endpoint = twisted.internet.endpoints.TCP4ServerEndpoint(
+ twisted.internet.reactor, args.port, backlog=128)
+ endpoint.listen(H2Factory(args.test_case))
+ twisted.internet.reactor.run()