summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcorehttp/tests')
-rwxr-xr-xindra/llcorehttp/tests/test_llcorehttp_peer.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py
index caa204b519..b900ad73ff 100755
--- a/indra/llcorehttp/tests/test_llcorehttp_peer.py
+++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py
@@ -48,7 +48,7 @@ from llbase import llsd
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
"llmessage", "tests"))
-from testrunner import freeport, run, debug, VERBOSE
+from testrunner import run, debug, VERBOSE
class TestHTTPRequestHandler(BaseHTTPRequestHandler):
"""This subclass of BaseHTTPRequestHandler is to receive and echo
@@ -297,22 +297,17 @@ if __name__ == "__main__":
if option == "-V" or option == "--valgrind":
do_valgrind = True
- # Instantiate a Server(TestHTTPRequestHandler) on the first free port
- # in the specified port range. Doing this inline is better than in a
- # daemon thread: if it blows up here, we'll get a traceback. If it blew up
- # in some other thread, the traceback would get eaten and we'd run the
- # subject test program anyway.
- httpd, port = freeport(xrange(8000, 8020),
- lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler))
+ # Instantiate a Server(TestHTTPRequestHandler) on a port chosen by the
+ # runtime.
+ httpd = Server(('127.0.0.1', 0), TestHTTPRequestHandler)
# Pass the selected port number to the subject test program via the
# environment. We don't want to impose requirements on the test program's
# command-line parsing -- and anyway, for C++ integration tests, that's
# performed in TUT code rather than our own.
- os.environ["LL_TEST_PORT"] = str(port)
+ os.environ["LL_TEST_PORT"] = str(httpd.server_port)
debug("$LL_TEST_PORT = %s", port)
if do_valgrind:
args = ["valgrind", "--log-file=./valgrind.log"] + args
path_search = True
- sys.exit(run(server=Thread(name="httpd", target=httpd.serve_forever), use_path=path_search, *args))
-
+ sys.exit(run(server_inst=httpd, use_path=path_search, *args))