# HG changeset patch # User Jun Wu # Date 1487260879 28800 # Node ID d4916aebf3d036d116359cf0c28c90e11ba9b16f # Parent d8d698bcdcd62646c0a6a7444764bb00b110e050 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 -r d8d698bcdcd6 -r d4916aebf3d0 tests/run-tests.py --- a/tests/run-tests.py Wed Feb 15 22:53:45 2017 -0800 +++ b/tests/run-tests.py Thu Feb 16 08:01:19 2017 -0800 @@ -857,6 +857,12 @@ else: 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.""" def defineport(i): @@ -881,6 +887,10 @@ env["HGENCODINGMODE"] = "strict" 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. env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C'