comparison tests/run-tests.py @ 46754:9ba00a9dc6ea

run-test: install rhg if --rhg is passed Before this, --rhg was only working with --local. Differential Revision: https://phab.mercurial-scm.org/D10195
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Mar 2021 13:54:46 +0100
parents 78e6700ab009
children d4ba4d51f85f
comparison
equal deleted inserted replaced
46753:99c0b03894ee 46754:9ba00a9dc6ea
3387 else: 3387 else:
3388 self._usecorrectpython() 3388 self._usecorrectpython()
3389 if self.options.chg: 3389 if self.options.chg:
3390 assert self._installdir 3390 assert self._installdir
3391 self._installchg() 3391 self._installchg()
3392 if self.options.rhg:
3393 assert self._installdir
3394 self._installrhg()
3392 3395
3393 log( 3396 log(
3394 'running %d tests using %d parallel processes' 3397 'running %d tests using %d parallel processes'
3395 % (num_tests, jobs) 3398 % (num_tests, jobs)
3396 ) 3399 )
3748 sys.stdout.buffer.write(out) 3751 sys.stdout.buffer.write(out)
3749 else: 3752 else:
3750 sys.stdout.write(out) 3753 sys.stdout.write(out)
3751 sys.exit(1) 3754 sys.exit(1)
3752 3755
3756 def _installrhg(self):
3757 """Install rhg into the test environment"""
3758 vlog('# Performing temporary installation of rhg')
3759 assert os.path.dirname(self._bindir) == self._installdir
3760 assert self._hgroot, 'must be called after _installhg()'
3761 cmd = b'"%(make)s" install-rhg PREFIX="%(prefix)s"' % {
3762 b'make': b'make', # TODO: switch by option or environment?
3763 b'prefix': self._installdir,
3764 }
3765 cwd = self._hgroot
3766 vlog("# Running", cmd)
3767 proc = subprocess.Popen(
3768 cmd,
3769 shell=True,
3770 cwd=cwd,
3771 stdin=subprocess.PIPE,
3772 stdout=subprocess.PIPE,
3773 stderr=subprocess.STDOUT,
3774 )
3775 out, _err = proc.communicate()
3776 if proc.returncode != 0:
3777 if PYTHON3:
3778 sys.stdout.buffer.write(out)
3779 else:
3780 sys.stdout.write(out)
3781 sys.exit(1)
3782
3753 def _outputcoverage(self): 3783 def _outputcoverage(self):
3754 """Produce code coverage output.""" 3784 """Produce code coverage output."""
3755 import coverage 3785 import coverage
3756 3786
3757 coverage = coverage.coverage 3787 coverage = coverage.coverage