From 063ecdb2bb5a4b482f61a023fb069de78bc72105 Mon Sep 17 00:00:00 2001 From: Jun Wu Date: Wed, 15 Feb 2017 21:09:00 -0800 Subject: [PATCH] dumbhttp: use IPv6 if HGIPV6 is set to 1 This will fix flaky tests using dumbhttp. The patch was tested on gcc112.fsffrance.org using the following command: ./run-tests.py -j 40 --runs-per-test 120 test-bundle2-remote-changegroup.t --- tests/dumbhttp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py index cf65e7909e..55c596e3db 100755 --- a/tests/dumbhttp.py +++ b/tests/dumbhttp.py @@ -7,7 +7,9 @@ Small and dumb HTTP server for use in tests. """ import optparse +import os import signal +import socket import sys from mercurial import ( @@ -18,11 +20,17 @@ from mercurial import ( httpserver = util.httpserver OptionParser = optparse.OptionParser +if os.environ.get('HGIPV6', '0') == '1': + class simplehttpserver(httpserver.httpserver): + address_family = socket.AF_INET6 +else: + simplehttpserver = httpserver.httpserver + class simplehttpservice(object): def __init__(self, host, port): self.address = (host, port) def init(self): - self.httpd = httpserver.httpserver( + self.httpd = simplehttpserver( self.address, httpserver.simplehttprequesthandler) def run(self): self.httpd.serve_forever()