##// END OF EJS Templates
run-tests: rely on an actual executable in PATH instead of alias for `hg`...
marmoute -
r48388:eb611ecb default
parent child Browse files
Show More
@@ -359,6 +359,21 b' def canonpath(path):'
359 359 return os.path.realpath(os.path.expanduser(path))
360 360
361 361
362 def which(exe):
363 if PYTHON3:
364 # shutil.which only accept bytes from 3.8
365 cmd = _bytes2sys(exe)
366 real_exec = shutil.which(cmd)
367 return _sys2bytes(real_exec)
368 else:
369 # let us do the os work
370 for p in osenvironb[b'PATH'].split(os.pathsep):
371 f = os.path.join(p, exe)
372 if os.path.isfile(f):
373 return f
374 return None
375
376
362 377 def parselistfiles(files, listtype, warn=True):
363 378 entries = dict()
364 379 for filename in files:
@@ -1829,8 +1844,6 b' class TTest(Test):'
1829 1844
1830 1845 if self._debug:
1831 1846 script.append(b'set -x\n')
1832 if self._hgcommand != b'hg':
1833 script.append(b'alias hg="%s"\n' % self._hgcommand)
1834 1847 if os.getenv('MSYSTEM'):
1835 1848 script.append(b'alias pwd="pwd -W"\n')
1836 1849
@@ -3436,6 +3449,7 b' class TestRunner(object):'
3436 3449 if self.options.rhg:
3437 3450 assert self._installdir
3438 3451 self._installrhg()
3452 self._use_correct_mercurial()
3439 3453
3440 3454 log(
3441 3455 'running %d tests using %d parallel processes'
@@ -3628,6 +3642,25 b' class TestRunner(object):'
3628 3642 if not self._findprogram(pyexename):
3629 3643 print("WARNING: Cannot find %s in search path" % pyexename)
3630 3644
3645 def _use_correct_mercurial(self):
3646 target_exec = os.path.join(self._custom_bin_dir, b'hg')
3647 if self._hgcommand != b'hg':
3648 # shutil.which only accept bytes from 3.8
3649 real_exec = which(self._hgcommand)
3650 if real_exec is None:
3651 raise ValueError('could not find exec path for "%s"', real_exec)
3652 if real_exec == target_exec:
3653 # do not overwrite something with itself
3654 return
3655 if WINDOWS:
3656 with open(target_exec, 'wb') as f:
3657 f.write(b'#!/bin/sh\n')
3658 escaped_exec = shellquote(_bytes2sys(real_exec))
3659 f.write(b'%s "$@"\n' % _sys2bytes(escaped_exec))
3660 else:
3661 os.symlink(real_exec, target_exec)
3662 self._createdfiles.append(target_exec)
3663
3631 3664 def _installhg(self):
3632 3665 """Install hg into the test environment.
3633 3666
@@ -751,10 +751,12 b' Check output capture control.'
751 751 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
752 752 pushing to ssh://user@dummy/other
753 753 searching for changes
754 remote: Fail early! (no-py3 chg !)
754 755 remote: adding changesets
755 756 remote: adding manifests
756 757 remote: adding file changes
757 remote: Fail early!
758 remote: Fail early! (py3 !)
759 remote: Fail early! (no-py3 no-chg !)
758 760 remote: transaction abort!
759 761 remote: Cleaning up the mess...
760 762 remote: rollback completed
@@ -648,14 +648,12 b' Running In Debug Mode'
648 648
649 649 $ rt --debug 2>&1 | grep -v pwd
650 650 running 2 tests using 1 parallel processes
651 + alias hg=hg.exe (windows !)
652 651 + echo *SALT* 0 0 (glob)
653 652 *SALT* 0 0 (glob)
654 653 + echo babar
655 654 babar
656 655 + echo *SALT* 10 0 (glob)
657 656 *SALT* 10 0 (glob)
658 .+ alias hg=hg.exe (windows !)
659 657 *+ echo *SALT* 0 0 (glob)
660 658 *SALT* 0 0 (glob)
661 659 + echo babar
@@ -304,8 +304,10 b' push should succeed even though it has a'
304 304 remote: adding changesets
305 305 remote: adding manifests
306 306 remote: adding file changes
307 remote: added 1 changesets with 1 changes to 1 files
307 remote: added 1 changesets with 1 changes to 1 files (py3 !)
308 remote: added 1 changesets with 1 changes to 1 files (no-py3 no-chg !)
308 309 remote: KABOOM
310 remote: added 1 changesets with 1 changes to 1 files (no-py3 chg !)
309 311 $ hg -R ../remote heads
310 312 changeset: 5:1383141674ec
311 313 tag: tip
@@ -474,8 +476,10 b' stderr from remote commands should be pr'
474 476 remote: adding changesets
475 477 remote: adding manifests
476 478 remote: adding file changes
477 remote: added 1 changesets with 1 changes to 1 files
479 remote: added 1 changesets with 1 changes to 1 files (py3 !)
480 remote: added 1 changesets with 1 changes to 1 files (no-py3 no-chg !)
478 481 remote: KABOOM
482 remote: added 1 changesets with 1 changes to 1 files (no-py3 chg !)
479 483 local stdout
480 484
481 485 debug output
@@ -301,9 +301,11 b' push should succeed even though it has a'
301 301 remote: adding changesets
302 302 remote: adding manifests
303 303 remote: adding file changes
304 remote: added 1 changesets with 1 changes to 1 files
304 remote: added 1 changesets with 1 changes to 1 files (py3 !)
305 remote: added 1 changesets with 1 changes to 1 files (no-py3 no-chg !)
305 306 remote: KABOOM
306 307 remote: KABOOM IN PROCESS
308 remote: added 1 changesets with 1 changes to 1 files (no-py3 chg !)
307 309 $ hg -R ../remote heads
308 310 changeset: 5:1383141674ec
309 311 tag: tip
@@ -527,9 +529,11 b' stderr from remote commands should be pr'
527 529 remote: adding changesets
528 530 remote: adding manifests
529 531 remote: adding file changes
530 remote: added 1 changesets with 1 changes to 1 files
532 remote: added 1 changesets with 1 changes to 1 files (py3 !)
533 remote: added 1 changesets with 1 changes to 1 files (no-py3 no-chg !)
531 534 remote: KABOOM
532 535 remote: KABOOM IN PROCESS
536 remote: added 1 changesets with 1 changes to 1 files (no-py3 chg !)
533 537 local stdout
534 538
535 539 debug output
@@ -35,9 +35,12 b' disconnecting. Then exit nonzero, to for'
35 35 $ hg push -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --remotecmd "$remotecmd"
36 36 pushing to ssh://user@dummy/$TESTTMP/remote
37 37 searching for changes
38 remote: adding changesets
39 remote: adding manifests
40 remote: adding file changes
38 remote: adding changesets (py3 !)
39 remote: adding manifests (py3 !)
40 remote: adding file changes (py3 !)
41 remote: adding changesets (no-py3 no-chg !)
42 remote: adding manifests (no-py3 no-chg !)
43 remote: adding file changes (no-py3 no-chg !)
41 44 abort: stream ended unexpectedly (got 0 bytes, expected 4)
42 45 [255]
43 46 $ cat $SIGPIPE_REMOTE_DEBUG_FILE
General Comments 0
You need to be logged in to leave comments. Login now