From 8800ffa23867f60c01219a9699607ed08672bc2d Mon Sep 17 00:00:00 2001 From: Ray Brown Date: Tue, 11 Dec 2012 19:02:24 -0800 Subject: [PATCH] Add fixed suite port command line option When running in remote server mode (-s), the value of the -s option specifies which port remote clients must connect to for the job transmission protocol. The servers for individual suite runs, however, would be placed at dynamically assigned ports, with port numbers transmitted to clients through job parameters. This does not work well when servers sit behind firewalls with restricted UDP port ranges. This patch introduces the -p option, allowing ports for server runs to remain fixed at the given port (which, of course, must not conflict with the port number supplied with -s). --- dtls/test/test_perf.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dtls/test/test_perf.py b/dtls/test/test_perf.py index 0479438..7c660e1 100644 --- a/dtls/test/test_perf.py +++ b/dtls/test/test_perf.py @@ -316,13 +316,15 @@ def remote_client(manager_address): # Test runner # -def run_test(server_args, client_args): +def run_test(server_args, client_args, port): + if port is None: + port = 0 if QUEUE: # bind to all interfaces, for remote clients - listen_addr = '', 0 + listen_addr = '', port else: # bind to loopback only, for local clients - listen_addr = 'localhost', 0 + listen_addr = 'localhost', port svr = iter(server(*server_args, listen_addr=listen_addr)) listen_addr = svr.next() listen_addr = 'localhost', listen_addr[1] @@ -369,6 +371,8 @@ if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("-s", "--server", type=port, metavar="PORT", help="local server port for remote clients") + parser.add_argument("-p", "--port", type=port, metavar="SUITEPORT", + help="fixed suite port instead of dynamic assignment") parser.add_argument("-c", "--client", type=endpoint, metavar="ENDPOINT", help="remote server endpoint for this client") args = parser.parse_args() @@ -407,6 +411,6 @@ if __name__ == "__main__": break if not choice: break - run_test(suites[selector[choice]], suites[selector[choice]]) + run_test(suites[selector[choice]], suites[selector[choice]], args.port) if args.server: stop_client_manager()