comparison tests/run-tests.py @ 30986:f07ca071a058

runtests: set web.ipv6 if we use IPv6 As explained by the previous patch, we need to set "web.ipv6=True" if we decide to use IPv6. Otherwise "hg serve" will still try to listen on IPv4. This patch makes it so by appending web.ipv6 to "extra configs". This patch was tested in a Linux system with IPv6, by the following steps: 1. Change hgweb/server.py temporarily to write a file if IPv6HTTPServer.__init__ is called. 2. run-tests.py -l --keep-tmpdir test-serve.t 3. Check the generated .hgrc, make sure it sets web.ipv6=1. 4. Check the log file to make sure IPv6HTTPServer.__init__ is called.
author Jun Wu <quark@fb.com>
date Wed, 15 Feb 2017 16:43:27 -0800
parents 1f803482844a
children 1ee685defe80
comparison
equal deleted inserted replaced
30985:1f803482844a 30986:f07ca071a058
533 def __init__(self, path, tmpdir, keeptmpdir=False, 533 def __init__(self, path, tmpdir, keeptmpdir=False,
534 debug=False, 534 debug=False,
535 timeout=defaults['timeout'], 535 timeout=defaults['timeout'],
536 startport=defaults['port'], extraconfigopts=None, 536 startport=defaults['port'], extraconfigopts=None,
537 py3kwarnings=False, shell=None, hgcommand=None, 537 py3kwarnings=False, shell=None, hgcommand=None,
538 slowtimeout=defaults['slowtimeout'], usechg=False): 538 slowtimeout=defaults['slowtimeout'], usechg=False,
539 useipv6=False):
539 """Create a test from parameters. 540 """Create a test from parameters.
540 541
541 path is the full path to the file defining the test. 542 path is the full path to the file defining the test.
542 543
543 tmpdir is the main temporary directory to use for this test. 544 tmpdir is the main temporary directory to use for this test.
590 self._ret = None 591 self._ret = None
591 self._out = None 592 self._out = None
592 self._skipped = None 593 self._skipped = None
593 self._testtmp = None 594 self._testtmp = None
594 self._chgsockdir = None 595 self._chgsockdir = None
596
597 # If IPv6 is used, set web.ipv6=1 in hgrc so servers will use IPv6
598 if useipv6:
599 self._extraconfigopts = list(self._extraconfigopts)
600 self._extraconfigopts.append('web.ipv6 = True')
595 601
596 # If we're not in --debug mode and reference output file exists, 602 # If we're not in --debug mode and reference output file exists,
597 # check test output against it. 603 # check test output against it.
598 if debug: 604 if debug:
599 self._refout = None # to match "out is None" 605 self._refout = None # to match "out is None"
2315 startport=self._getport(count), 2321 startport=self._getport(count),
2316 extraconfigopts=self.options.extra_config_opt, 2322 extraconfigopts=self.options.extra_config_opt,
2317 py3kwarnings=self.options.py3k_warnings, 2323 py3kwarnings=self.options.py3k_warnings,
2318 shell=self.options.shell, 2324 shell=self.options.shell,
2319 hgcommand=self._hgcommand, 2325 hgcommand=self._hgcommand,
2320 usechg=bool(self.options.with_chg or self.options.chg)) 2326 usechg=bool(self.options.with_chg or self.options.chg),
2327 useipv6=useipv6)
2321 t.should_reload = True 2328 t.should_reload = True
2322 return t 2329 return t
2323 2330
2324 def _cleanup(self): 2331 def _cleanup(self):
2325 """Clean up state from this test invocation.""" 2332 """Clean up state from this test invocation."""