Mercurial > hg
changeset 31004:d05fefbb5ab3
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
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 15 Feb 2017 21:09:00 -0800 |
parents | 225f574e0645 |
children | d8d698bcdcd6 |
files | tests/dumbhttp.py |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/dumbhttp.py Wed Feb 15 21:03:42 2017 -0800 +++ b/tests/dumbhttp.py Wed Feb 15 21:09:00 2017 -0800 @@ -7,7 +7,9 @@ """ import optparse +import os import signal +import socket import sys from mercurial import ( @@ -18,11 +20,17 @@ 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()