Mercurial > hg
comparison tests/run-tests.py @ 31006:d4916aebf3d0
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 16 Feb 2017 08:01:19 -0800 |
parents | 225f574e0645 |
children | 636cf3f7620d |
comparison
equal
deleted
inserted
replaced
31005:d8d698bcdcd6 | 31006:d4916aebf3d0 |
---|---|
855 for c in p)) | 855 for c in p)) |
856 ) | 856 ) |
857 else: | 857 else: |
858 return re.escape(p) | 858 return re.escape(p) |
859 | 859 |
860 def _localip(self): | |
861 if self._useipv6: | |
862 return b'::1' | |
863 else: | |
864 return b'127.0.0.1' | |
865 | |
860 def _getenv(self): | 866 def _getenv(self): |
861 """Obtain environment variables to use during test execution.""" | 867 """Obtain environment variables to use during test execution.""" |
862 def defineport(i): | 868 def defineport(i): |
863 offset = '' if i == 0 else '%s' % i | 869 offset = '' if i == 0 else '%s' % i |
864 env["HGPORT%s" % offset] = '%s' % (self._startport + i) | 870 env["HGPORT%s" % offset] = '%s' % (self._startport + i) |
878 env["HGMERGE"] = "internal:merge" | 884 env["HGMERGE"] = "internal:merge" |
879 env["HGUSER"] = "test" | 885 env["HGUSER"] = "test" |
880 env["HGENCODING"] = "ascii" | 886 env["HGENCODING"] = "ascii" |
881 env["HGENCODINGMODE"] = "strict" | 887 env["HGENCODINGMODE"] = "strict" |
882 env['HGIPV6'] = str(int(self._useipv6)) | 888 env['HGIPV6'] = str(int(self._useipv6)) |
889 | |
890 # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw | |
891 # IP addresses. | |
892 env['LOCALIP'] = self._localip() | |
883 | 893 |
884 # Reset some environment variables to well-known values so that | 894 # Reset some environment variables to well-known values so that |
885 # the tests produce repeatable output. | 895 # the tests produce repeatable output. |
886 env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C' | 896 env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C' |
887 env['TZ'] = 'GMT' | 897 env['TZ'] = 'GMT' |