# HG changeset patch # User Jun Wu <qu...@fb.com> # Date 1487260879 28800 # Thu Feb 16 08:01:19 2017 -0800 # Node ID ce9f5e640bdfcc6270f0be98d7fc6520740ba464 # Parent b38591e034d5508ddfc73d50b95d6b29d6370671 # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r ce9f5e640bdf runtests: export LOCALIP
Previously, tests hard-code local IP address as "127.0.0.1". That won't work for IPv6. This patch exports the $LOCALIP environment variable, which is set to "::1" if we decide to use IPv6. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -833,4 +833,5 @@ class Test(unittest.TestCase): (br'(?m)^(saved backup bundle to .*\.hg)( \(glob\))?$', br'\1 (glob)'), + (br'([^0-9])%s' % re.escape(self._localip()), br'\1$LOCALIP'), ] r.append((self._escapepath(self._testtmp), b'$TESTTMP')) @@ -848,4 +849,10 @@ class Test(unittest.TestCase): return re.escape(p) + def _localip(self): + if self._useipv6: + return b'::1' + else: + return b'127.0.0.1' + def _getenv(self): """Obtain environment variables to use during test execution.""" @@ -872,4 +879,8 @@ class Test(unittest.TestCase): env['HGIPV6'] = str(int(self._useipv6)) + # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw + # IP addresses. + env['LOCALIP'] = self._localip() + # Reset some environment variables to well-known values so that # the tests produce repeatable output. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel