[PATCH 03 of 10 ipv6 V2] dumbhttp: use IPv6 if HGIPV6 is set to 1
Jun Wu
quark at fb.com
Fri Feb 17 13:51:17 EST 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1487221740 28800
# Wed Feb 15 21:09:00 2017 -0800
# Node ID 5e76ef1698fde7a47fa78003beac71324793d051
# Parent a16166a6c56f6289252a9c2e72117385756a45c3
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 5e76ef1698fd
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
diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py
--- a/tests/dumbhttp.py
+++ b/tests/dumbhttp.py
@@ -8,5 +8,7 @@ Small and dumb HTTP server for use in te
import optparse
+import os
import signal
+import socket
import sys
@@ -19,9 +21,15 @@ 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):
More information about the Mercurial-devel
mailing list