Mercurial > hg
comparison tests/run-tests.py @ 47584:ee1fc8f970e6
run-tests: introduce a `HGTEST_REAL_HG` variable for test
It turns out that currently, `hg` and `which hg` can point to different things
because `hg` is an alias… This is annoying because script and pieces of test
are unknowingly using the wrong `hg`.
We will fix it in another changeset. However some test actually need to use a
real `hg` binary and not some `chg` or `rhg` equivalent. So we introduce a new
variable with the right value and we put it to us in the appropriate location.
Differential Revision: https://phab.mercurial-scm.org/D11049
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 09 Jul 2021 20:03:46 +0200 |
parents | 05abe1ff1edd |
children | 5654323832f0 |
comparison
equal
deleted
inserted
replaced
47583:05abe1ff1edd | 47584:ee1fc8f970e6 |
---|---|
3158 # enabled by hg.exe, and this is a more realistic way to launch hg | 3158 # enabled by hg.exe, and this is a more realistic way to launch hg |
3159 # anyway. | 3159 # anyway. |
3160 if WINDOWS and not self._hgcommand.endswith(b'.exe'): | 3160 if WINDOWS and not self._hgcommand.endswith(b'.exe'): |
3161 self._hgcommand += b'.exe' | 3161 self._hgcommand += b'.exe' |
3162 | 3162 |
3163 real_hg = os.path.join(self._bindir, self._hgcommand) | |
3164 osenvironb[b'HGTEST_REAL_HG'] = real_hg | |
3163 # set CHGHG, then replace "hg" command by "chg" | 3165 # set CHGHG, then replace "hg" command by "chg" |
3164 chgbindir = self._bindir | 3166 chgbindir = self._bindir |
3165 if self.options.chg or self.options.with_chg: | 3167 if self.options.chg or self.options.with_chg: |
3166 osenvironb[b'CHGHG'] = os.path.join(self._bindir, self._hgcommand) | 3168 osenvironb[b'CHGHG'] = real_hg |
3167 else: | 3169 else: |
3168 osenvironb.pop(b'CHGHG', None) # drop flag for hghave | 3170 osenvironb.pop(b'CHGHG', None) # drop flag for hghave |
3169 if self.options.chg: | 3171 if self.options.chg: |
3170 self._hgcommand = b'chg' | 3172 self._hgcommand = b'chg' |
3171 elif self.options.with_chg: | 3173 elif self.options.with_chg: |
3180 # Affects configuration. Alternatives would be setting configuration through | 3182 # Affects configuration. Alternatives would be setting configuration through |
3181 # `$HGRCPATH` but some tests override that, or changing `_hgcommand` to include | 3183 # `$HGRCPATH` but some tests override that, or changing `_hgcommand` to include |
3182 # `--config` but that disrupts tests that print command lines and check expected | 3184 # `--config` but that disrupts tests that print command lines and check expected |
3183 # output. | 3185 # output. |
3184 osenvironb[b'RHG_ON_UNSUPPORTED'] = b'fallback' | 3186 osenvironb[b'RHG_ON_UNSUPPORTED'] = b'fallback' |
3185 osenvironb[b'RHG_FALLBACK_EXECUTABLE'] = os.path.join( | 3187 osenvironb[b'RHG_FALLBACK_EXECUTABLE'] = real_hg |
3186 self._bindir, self._hgcommand | |
3187 ) | |
3188 if self.options.rhg: | 3188 if self.options.rhg: |
3189 self._hgcommand = b'rhg' | 3189 self._hgcommand = b'rhg' |
3190 elif self.options.with_rhg: | 3190 elif self.options.with_rhg: |
3191 rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) | 3191 rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) |
3192 self._hgcommand = os.path.basename(self.options.with_rhg) | 3192 self._hgcommand = os.path.basename(self.options.with_rhg) |