# HG changeset patch
# User Jun Wu <qu...@fb.com>
# Date 1487221740 28800
#      Wed Feb 15 21:09:00 2017 -0800
# Node ID 28bb800077fd83098320b6f21334a71eedf03bbe
# Parent  f2743873dfbd6adedcd3aa1777b651ce5bd6f6ed
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 28bb800077fd
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):
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to