Mercurial > hg
comparison tests/run-tests.py @ 46723:a6553ba1c598
tests: Enable rhg fallback to Python by default in tests
This premise of `run-tests.py --rhg`: fallback should make
`rhg` behave the same as `hg`, except faster in some cases.
To test run the whole test suite with installed `rhg` as `hg`
and with fallback enabled.
Differential Revision: https://phab.mercurial-scm.org/D10187
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 02 Mar 2021 22:42:10 +0100 |
parents | fb2368598281 |
children | 78e6700ab009 |
comparison
equal
deleted
inserted
replaced
46722:08a35cec14d4 | 46723:a6553ba1c598 |
---|---|
965 shell=None, | 965 shell=None, |
966 hgcommand=None, | 966 hgcommand=None, |
967 slowtimeout=None, | 967 slowtimeout=None, |
968 usechg=False, | 968 usechg=False, |
969 chgdebug=False, | 969 chgdebug=False, |
970 rhg_fallback_exe=None, | |
971 useipv6=False, | 970 useipv6=False, |
972 ): | 971 ): |
973 """Create a test from parameters. | 972 """Create a test from parameters. |
974 | 973 |
975 path is the full path to the file defining the test. | 974 path is the full path to the file defining the test. |
1023 self._extraconfigopts = extraconfigopts or [] | 1022 self._extraconfigopts = extraconfigopts or [] |
1024 self._shell = _sys2bytes(shell) | 1023 self._shell = _sys2bytes(shell) |
1025 self._hgcommand = hgcommand or b'hg' | 1024 self._hgcommand = hgcommand or b'hg' |
1026 self._usechg = usechg | 1025 self._usechg = usechg |
1027 self._chgdebug = chgdebug | 1026 self._chgdebug = chgdebug |
1028 self._rhg_fallback_exe = rhg_fallback_exe | |
1029 self._useipv6 = useipv6 | 1027 self._useipv6 = useipv6 |
1030 | 1028 |
1031 self._aborted = False | 1029 self._aborted = False |
1032 self._daemonpids = [] | 1030 self._daemonpids = [] |
1033 self._finished = None | 1031 self._finished = None |
1505 ) | 1503 ) |
1506 hgrc.write(b'[web]\n') | 1504 hgrc.write(b'[web]\n') |
1507 hgrc.write(b'address = localhost\n') | 1505 hgrc.write(b'address = localhost\n') |
1508 hgrc.write(b'ipv6 = %r\n' % self._useipv6) | 1506 hgrc.write(b'ipv6 = %r\n' % self._useipv6) |
1509 hgrc.write(b'server-header = testing stub value\n') | 1507 hgrc.write(b'server-header = testing stub value\n') |
1510 | |
1511 if self._rhg_fallback_exe: | |
1512 hgrc.write(b'[rhg]\n') | |
1513 hgrc.write( | |
1514 b'fallback-executable = %s\n' % self._rhg_fallback_exe | |
1515 ) | |
1516 | 1508 |
1517 for opt in self._extraconfigopts: | 1509 for opt in self._extraconfigopts: |
1518 section, key = _sys2bytes(opt).split(b'.', 1) | 1510 section, key = _sys2bytes(opt).split(b'.', 1) |
1519 assert b'=' in key, ( | 1511 assert b'=' in key, ( |
1520 'extra config opt %s must ' 'have an = for assignment' % opt | 1512 'extra config opt %s must ' 'have an = for assignment' % opt |
2997 self._tmpbindir = None | 2989 self._tmpbindir = None |
2998 self._pythondir = None | 2990 self._pythondir = None |
2999 self._coveragefile = None | 2991 self._coveragefile = None |
3000 self._createdfiles = [] | 2992 self._createdfiles = [] |
3001 self._hgcommand = None | 2993 self._hgcommand = None |
3002 self._rhg_fallback_exe = None | |
3003 self._hgpath = None | 2994 self._hgpath = None |
3004 self._portoffset = 0 | 2995 self._portoffset = 0 |
3005 self._ports = {} | 2996 self._ports = {} |
3006 | 2997 |
3007 def run(self, args, parser=None): | 2998 def run(self, args, parser=None): |
3138 self._hgcommand = b'chg' | 3129 self._hgcommand = b'chg' |
3139 elif self.options.with_chg: | 3130 elif self.options.with_chg: |
3140 chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg)) | 3131 chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg)) |
3141 self._hgcommand = os.path.basename(self.options.with_chg) | 3132 self._hgcommand = os.path.basename(self.options.with_chg) |
3142 | 3133 |
3143 # set fallback executable path, then replace "hg" command by "rhg" | 3134 # configure fallback and replace "hg" command by "rhg" |
3144 rhgbindir = self._bindir | 3135 rhgbindir = self._bindir |
3145 if self.options.rhg or self.options.with_rhg: | 3136 if self.options.rhg or self.options.with_rhg: |
3146 self._rhg_fallback_exe = os.path.join(self._bindir, self._hgcommand) | 3137 # Affects configuration. Alternatives would be setting configuration through |
3138 # `$HGRCPATH` but some tests override that, or changing `_hgcommand` to include | |
3139 # `--config` but that disrupts tests that print command lines and check expected | |
3140 # output. | |
3141 osenvironb[b'RHG_ON_UNSUPPORTED'] = b'fallback' | |
3142 osenvironb[b'RHG_FALLBACK_EXECUTABLE'] = os.path.join( | |
3143 self._bindir, self._hgcommand | |
3144 ) | |
3147 if self.options.rhg: | 3145 if self.options.rhg: |
3148 self._hgcommand = b'rhg' | 3146 self._hgcommand = b'rhg' |
3149 elif self.options.with_rhg: | 3147 elif self.options.with_rhg: |
3150 rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) | 3148 rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) |
3151 self._hgcommand = os.path.basename(self.options.with_rhg) | 3149 self._hgcommand = os.path.basename(self.options.with_rhg) |
3475 extraconfigopts=self.options.extra_config_opt, | 3473 extraconfigopts=self.options.extra_config_opt, |
3476 shell=self.options.shell, | 3474 shell=self.options.shell, |
3477 hgcommand=self._hgcommand, | 3475 hgcommand=self._hgcommand, |
3478 usechg=bool(self.options.with_chg or self.options.chg), | 3476 usechg=bool(self.options.with_chg or self.options.chg), |
3479 chgdebug=self.options.chg_debug, | 3477 chgdebug=self.options.chg_debug, |
3480 rhg_fallback_exe=self._rhg_fallback_exe, | |
3481 useipv6=useipv6, | 3478 useipv6=useipv6, |
3482 **kwds | 3479 **kwds |
3483 ) | 3480 ) |
3484 t.should_reload = True | 3481 t.should_reload = True |
3485 return t | 3482 return t |