423 "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set") |
423 "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set") |
424 hgconf.add_argument("--ipv6", action="store_true", |
424 hgconf.add_argument("--ipv6", action="store_true", |
425 help="prefer IPv6 to IPv4 for network related tests") |
425 help="prefer IPv6 to IPv4 for network related tests") |
426 hgconf.add_argument("--pure", action="store_true", |
426 hgconf.add_argument("--pure", action="store_true", |
427 help="use pure Python code instead of C extensions") |
427 help="use pure Python code instead of C extensions") |
428 hgconf.add_argument("-3", "--py3k-warnings", action="store_true", |
428 hgconf.add_argument("-3", "--py3-warnings", action="store_true", |
429 help="enable Py3k warnings on Python 2.7+") |
429 help="enable Py3k warnings on Python 2.7+") |
430 hgconf.add_argument("--with-chg", metavar="CHG", |
430 hgconf.add_argument("--with-chg", metavar="CHG", |
431 help="use specified chg wrapper in place of hg") |
431 help="use specified chg wrapper in place of hg") |
432 hgconf.add_argument("--with-hg", |
432 hgconf.add_argument("--with-hg", |
433 metavar="HG", |
433 metavar="HG", |
560 if options.slowtimeout != defaults['slowtimeout']: |
560 if options.slowtimeout != defaults['slowtimeout']: |
561 sys.stderr.write( |
561 sys.stderr.write( |
562 'warning: --slowtimeout option ignored with --debug\n') |
562 'warning: --slowtimeout option ignored with --debug\n') |
563 options.timeout = 0 |
563 options.timeout = 0 |
564 options.slowtimeout = 0 |
564 options.slowtimeout = 0 |
565 if options.py3k_warnings: |
565 if options.py3_warnings: |
566 if PYTHON3: |
566 if PYTHON3: |
567 parser.error( |
567 parser.error( |
568 '--py3k-warnings can only be used on Python 2.7') |
568 '--py3-warnings can only be used on Python 2.7') |
569 |
569 |
570 if options.blacklist: |
570 if options.blacklist: |
571 options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
571 options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
572 if options.whitelist: |
572 if options.whitelist: |
573 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') |
573 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') |
687 def __init__(self, path, outputdir, tmpdir, keeptmpdir=False, |
687 def __init__(self, path, outputdir, tmpdir, keeptmpdir=False, |
688 debug=False, |
688 debug=False, |
689 first=False, |
689 first=False, |
690 timeout=None, |
690 timeout=None, |
691 startport=None, extraconfigopts=None, |
691 startport=None, extraconfigopts=None, |
692 py3kwarnings=False, shell=None, hgcommand=None, |
692 py3warnings=False, shell=None, hgcommand=None, |
693 slowtimeout=None, usechg=False, |
693 slowtimeout=None, usechg=False, |
694 useipv6=False): |
694 useipv6=False): |
695 """Create a test from parameters. |
695 """Create a test from parameters. |
696 |
696 |
697 path is the full path to the file defining the test. |
697 path is the full path to the file defining the test. |
716 |
716 |
717 extraconfigopts is an iterable of extra hgrc config options. Values |
717 extraconfigopts is an iterable of extra hgrc config options. Values |
718 must have the form "key=value" (something understood by hgrc). Values |
718 must have the form "key=value" (something understood by hgrc). Values |
719 of the form "foo.key=value" will result in "[foo] key=value". |
719 of the form "foo.key=value" will result in "[foo] key=value". |
720 |
720 |
721 py3kwarnings enables Py3k warnings. |
721 py3warnings enables Py3k warnings. |
722 |
722 |
723 shell is the shell to execute tests in. |
723 shell is the shell to execute tests in. |
724 """ |
724 """ |
725 if timeout is None: |
725 if timeout is None: |
726 timeout = defaults['timeout'] |
726 timeout = defaults['timeout'] |
742 self._first = first |
742 self._first = first |
743 self._timeout = timeout |
743 self._timeout = timeout |
744 self._slowtimeout = slowtimeout |
744 self._slowtimeout = slowtimeout |
745 self._startport = startport |
745 self._startport = startport |
746 self._extraconfigopts = extraconfigopts or [] |
746 self._extraconfigopts = extraconfigopts or [] |
747 self._py3kwarnings = py3kwarnings |
747 self._py3warnings = py3warnings |
748 self._shell = _bytespath(shell) |
748 self._shell = _bytespath(shell) |
749 self._hgcommand = hgcommand or b'hg' |
749 self._hgcommand = hgcommand or b'hg' |
750 self._usechg = usechg |
750 self._usechg = usechg |
751 self._useipv6 = useipv6 |
751 self._useipv6 = useipv6 |
752 |
752 |
1216 @property |
1216 @property |
1217 def refpath(self): |
1217 def refpath(self): |
1218 return os.path.join(self._testdir, b'%s.out' % self.bname) |
1218 return os.path.join(self._testdir, b'%s.out' % self.bname) |
1219 |
1219 |
1220 def _run(self, env): |
1220 def _run(self, env): |
1221 py3kswitch = self._py3kwarnings and b' -3' or b'' |
1221 py3switch = self._py3warnings and b' -3' or b'' |
1222 cmd = b'"%s"%s "%s"' % (PYTHON, py3kswitch, self.path) |
1222 cmd = b'%s%s "%s"' % (PYTHON, py3switch, self.path) |
1223 vlog("# Running", cmd) |
1223 vlog("# Running", cmd) |
1224 normalizenewlines = os.name == 'nt' |
1224 normalizenewlines = os.name == 'nt' |
1225 result = self._runcommand(cmd, env, |
1225 result = self._runcommand(cmd, env, |
1226 normalizenewlines=normalizenewlines) |
1226 normalizenewlines=normalizenewlines) |
1227 if self._aborted: |
1227 if self._aborted: |
2895 debug=self.options.debug, |
2895 debug=self.options.debug, |
2896 first=self.options.first, |
2896 first=self.options.first, |
2897 timeout=self.options.timeout, |
2897 timeout=self.options.timeout, |
2898 startport=self._getport(count), |
2898 startport=self._getport(count), |
2899 extraconfigopts=self.options.extra_config_opt, |
2899 extraconfigopts=self.options.extra_config_opt, |
2900 py3kwarnings=self.options.py3k_warnings, |
2900 py3warnings=self.options.py3_warnings, |
2901 shell=self.options.shell, |
2901 shell=self.options.shell, |
2902 hgcommand=self._hgcommand, |
2902 hgcommand=self._hgcommand, |
2903 usechg=bool(self.options.with_chg or self.options.chg), |
2903 usechg=bool(self.options.with_chg or self.options.chg), |
2904 useipv6=useipv6, **kwds) |
2904 useipv6=useipv6, **kwds) |
2905 t.should_reload = True |
2905 t.should_reload = True |
3027 sys.exit(1) |
3027 sys.exit(1) |
3028 os.chdir(self._testdir) |
3028 os.chdir(self._testdir) |
3029 |
3029 |
3030 self._usecorrectpython() |
3030 self._usecorrectpython() |
3031 |
3031 |
3032 if self.options.py3k_warnings and not self.options.anycoverage: |
3032 if self.options.py3_warnings and not self.options.anycoverage: |
3033 vlog("# Updating hg command to enable Py3k Warnings switch") |
3033 vlog("# Updating hg command to enable Py3k Warnings switch") |
3034 with open(os.path.join(self._bindir, 'hg'), 'rb') as f: |
3034 with open(os.path.join(self._bindir, 'hg'), 'rb') as f: |
3035 lines = [line.rstrip() for line in f] |
3035 lines = [line.rstrip() for line in f] |
3036 lines[0] += ' -3' |
3036 lines[0] += ' -3' |
3037 with open(os.path.join(self._bindir, 'hg'), 'wb') as f: |
3037 with open(os.path.join(self._bindir, 'hg'), 'wb') as f: |