[PATCH 4 of 6 chg-test] run-tests: allow to specify executable of any name by --with-hg
Yuya Nishihara
yuya at tcha.org
Fri Feb 12 11:12:37 EST 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1454826099 -32400
# Sun Feb 07 15:21:39 2016 +0900
# Node ID 07088be4fbe16adfa2efdd9d5dba799909823acc
# Parent 97088e3b2707d37887b9203e78075107aec2b45c
run-tests: allow to specify executable of any name by --with-hg
If the executable is not named as "hg", TTest runner inserts alias. This
way, we can run tests with chg. But it is still warned because the alias
does not always work. We do "$BINDIR"/hg in a few places.
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -444,7 +444,7 @@ class Test(unittest.TestCase):
debug=False,
timeout=defaults['timeout'],
startport=defaults['port'], extraconfigopts=None,
- py3kwarnings=False, shell=None,
+ py3kwarnings=False, shell=None, hgcommand=None,
slowtimeout=defaults['slowtimeout'],
pythondir=None):
"""Create a test from parameters.
@@ -493,6 +493,7 @@ class Test(unittest.TestCase):
self._py3kwarnings = py3kwarnings
self._pythondir = pythondir
self._shell = _bytespath(shell)
+ self._hgcommand = hgcommand or b'hg'
self._aborted = False
self._daemonpids = []
@@ -992,6 +993,8 @@ class TTest(Test):
if self._debug:
script.append(b'set -x\n')
+ if self._hgcommand != b'hg':
+ script.append(b'alias hg="%s"\n' % self._hgcommand)
if os.getenv('MSYSTEM'):
script.append(b'alias pwd="pwd -W"\n')
@@ -1820,6 +1823,7 @@ class TestRunner(object):
self._pythondir = None
self._coveragefile = None
self._createdfiles = []
+ self._hgcommand = None
self._hgpath = None
self._portoffset = 0
self._ports = {}
@@ -1928,6 +1932,7 @@ class TestRunner(object):
whg = self.options.with_hg
self._bindir = os.path.dirname(os.path.realpath(whg))
assert isinstance(self._bindir, bytes)
+ self._hgcommand = os.path.basename(whg)
self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin')
os.makedirs(self._tmpbindir)
@@ -1940,6 +1945,7 @@ class TestRunner(object):
else:
self._installdir = os.path.join(self._hgtmp, b"install")
self._bindir = os.path.join(self._installdir, b"bin")
+ self._hgcommand = b'hg'
self._tmpbindir = self._bindir
self._pythondir = os.path.join(self._installdir, b"lib", b"python")
@@ -2121,6 +2127,7 @@ class TestRunner(object):
extraconfigopts=self.options.extra_config_opt,
py3kwarnings=self.options.py3k_warnings,
shell=self.options.shell,
+ hgcommand=self._hgcommand,
pythondir=self._pythondir)
t.should_reload = True
return t
More information about the Mercurial-devel
mailing list