Patchwork D8681: rhg: use a function in test-rhg.t instead of global alias

login
register
mail settings
Submitter phabricator
Date July 6, 2020, 9:18 a.m.
Message ID <differential-rev-PHID-DREV-cqhox63drs2g2hmack7w-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46629/
State Superseded
Headers show

Comments

phabricator - July 6, 2020, 9:18 a.m.
acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8681

AFFECTED FILES
  tests/run-tests.py
  tests/test-rhg.t

CHANGE DETAILS




To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -1,3 +1,13 @@ 
+#require rust
+
+  $ rhg() {
+  > if [ -f "$RUNTESTDIR/../rust/target/debug/rhg" ]; then
+  >   "$RUNTESTDIR/../rust/target/debug/rhg" "$@"
+  > else
+  >   echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg."
+  >   exit 80
+  > fi
+  > }
   $ rhg unimplemented-command
   [252]
   $ rhg root
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -927,7 +927,6 @@ 
         extraconfigopts=None,
         shell=None,
         hgcommand=None,
-        rhgcommand=None,
         slowtimeout=None,
         usechg=False,
         chgdebug=False,
@@ -985,9 +984,6 @@ 
         self._extraconfigopts = extraconfigopts or []
         self._shell = _sys2bytes(shell)
         self._hgcommand = hgcommand or b'hg'
-        self._rhgcommand = rhgcommand or _sys2bytes(
-            os.path.abspath('./rust/target/release/rhg')
-        )
         self._usechg = usechg
         self._chgdebug = chgdebug
         self._useipv6 = useipv6
@@ -1758,8 +1754,6 @@ 
             script.append(b'set -x\n')
         if self._hgcommand != b'hg':
             script.append(b'alias hg="%s"\n' % self._hgcommand)
-        if self._rhgcommand != b'rhg':
-            script.append(b'alias rhg="%s"\n' % self._rhgcommand)
         if os.getenv('MSYSTEM'):
             script.append(b'alias pwd="pwd -W"\n')
 
@@ -2956,7 +2950,6 @@ 
         self._coveragefile = None
         self._createdfiles = []
         self._hgcommand = None
-        self._rhgcommand = None
         self._hgpath = None
         self._portoffset = 0
         self._ports = {}