##// END OF EJS Templates
tests: Add `--rhg` and `--with-rhg=<path>` options for `run-tests.py`...
Simon Sapin -
r47426:fb236859 default
parent child Browse files
Show More
@@ -540,6 +540,11 b' def getparser():'
540 540 action="store_true",
541 541 help="show chg debug logs",
542 542 )
543 hgconf.add_argument(
544 "--rhg",
545 action="store_true",
546 help="install and use rhg Rust implementation in place of hg",
547 )
543 548 hgconf.add_argument("--compiler", help="compiler to build with")
544 549 hgconf.add_argument(
545 550 '--extra-config-opt',
@@ -552,6 +557,7 b' def getparser():'
552 557 "--local",
553 558 action="store_true",
554 559 help="shortcut for --with-hg=<testdir>/../hg, "
560 "--with-rhg=<testdir>/../rust/target/release/rhg if --rhg is set, "
555 561 "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set",
556 562 )
557 563 hgconf.add_argument(
@@ -580,6 +586,11 b' def getparser():'
580 586 help="use specified chg wrapper in place of hg",
581 587 )
582 588 hgconf.add_argument(
589 "--with-rhg",
590 metavar="RHG",
591 help="use specified rhg Rust implementation in place of hg",
592 )
593 hgconf.add_argument(
583 594 "--with-hg",
584 595 metavar="HG",
585 596 help="test using specified hg script rather than a "
@@ -667,13 +678,17 b' def parseargs(args, parser):'
667 678 parser.error('--rust cannot be used with --no-rust')
668 679
669 680 if options.local:
670 if options.with_hg or options.with_chg:
671 parser.error('--local cannot be used with --with-hg or --with-chg')
681 if options.with_hg or options.with_rhg or options.with_chg:
682 parser.error(
683 '--local cannot be used with --with-hg or --with-rhg or --with-chg'
684 )
672 685 testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0])))
673 686 reporootdir = os.path.dirname(testdir)
674 687 pathandattrs = [(b'hg', 'with_hg')]
675 688 if options.chg:
676 689 pathandattrs.append((b'contrib/chg/chg', 'with_chg'))
690 if options.rhg:
691 pathandattrs.append((b'rust/target/release/rhg', 'with_rhg'))
677 692 for relpath, attr in pathandattrs:
678 693 binpath = os.path.join(reporootdir, relpath)
679 694 if os.name != 'nt' and not os.access(binpath, os.X_OK):
@@ -696,6 +711,8 b' def parseargs(args, parser):'
696 711
697 712 if (options.chg or options.with_chg) and os.name == 'nt':
698 713 parser.error('chg does not work on %s' % os.name)
714 if (options.rhg or options.with_rhg) and os.name == 'nt':
715 parser.error('rhg does not work on %s' % os.name)
699 716 if options.with_chg:
700 717 options.chg = False # no installation to temporary location
701 718 options.with_chg = canonpath(_sys2bytes(options.with_chg))
@@ -704,12 +721,28 b' def parseargs(args, parser):'
704 721 and os.access(options.with_chg, os.X_OK)
705 722 ):
706 723 parser.error('--with-chg must specify a chg executable')
724 if options.with_rhg:
725 options.rhg = False # no installation to temporary location
726 options.with_rhg = canonpath(_sys2bytes(options.with_rhg))
727 if not (
728 os.path.isfile(options.with_rhg)
729 and os.access(options.with_rhg, os.X_OK)
730 ):
731 parser.error('--with-rhg must specify a rhg executable')
707 732 if options.chg and options.with_hg:
708 733 # chg shares installation location with hg
709 734 parser.error(
710 735 '--chg does not work when --with-hg is specified '
711 736 '(use --with-chg instead)'
712 737 )
738 if options.rhg and options.with_hg:
739 # rhg shares installation location with hg
740 parser.error(
741 '--rhg does not work when --with-hg is specified '
742 '(use --with-rhg instead)'
743 )
744 if options.rhg and options.chg:
745 parser.error('--rhg and --chg do not work together')
713 746
714 747 if options.color == 'always' and not pygmentspresent:
715 748 sys.stderr.write(
@@ -934,6 +967,7 b' class Test(unittest.TestCase):'
934 967 slowtimeout=None,
935 968 usechg=False,
936 969 chgdebug=False,
970 rhg_fallback_exe=None,
937 971 useipv6=False,
938 972 ):
939 973 """Create a test from parameters.
@@ -991,6 +1025,7 b' class Test(unittest.TestCase):'
991 1025 self._hgcommand = hgcommand or b'hg'
992 1026 self._usechg = usechg
993 1027 self._chgdebug = chgdebug
1028 self._rhg_fallback_exe = rhg_fallback_exe
994 1029 self._useipv6 = useipv6
995 1030
996 1031 self._aborted = False
@@ -1473,6 +1508,12 b' class Test(unittest.TestCase):'
1473 1508 hgrc.write(b'ipv6 = %r\n' % self._useipv6)
1474 1509 hgrc.write(b'server-header = testing stub value\n')
1475 1510
1511 if self._rhg_fallback_exe:
1512 hgrc.write(b'[rhg]\n')
1513 hgrc.write(
1514 b'fallback-executable = %s\n' % self._rhg_fallback_exe
1515 )
1516
1476 1517 for opt in self._extraconfigopts:
1477 1518 section, key = _sys2bytes(opt).split(b'.', 1)
1478 1519 assert b'=' in key, (
@@ -2958,6 +2999,7 b' class TestRunner(object):'
2958 2999 self._coveragefile = None
2959 3000 self._createdfiles = []
2960 3001 self._hgcommand = None
3002 self._rhg_fallback_exe = None
2961 3003 self._hgpath = None
2962 3004 self._portoffset = 0
2963 3005 self._ports = {}
@@ -3098,6 +3140,16 b' class TestRunner(object):'
3098 3140 chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg))
3099 3141 self._hgcommand = os.path.basename(self.options.with_chg)
3100 3142
3143 # set fallback executable path, then replace "hg" command by "rhg"
3144 rhgbindir = self._bindir
3145 if self.options.rhg or self.options.with_rhg:
3146 self._rhg_fallback_exe = os.path.join(self._bindir, self._hgcommand)
3147 if self.options.rhg:
3148 self._hgcommand = b'rhg'
3149 elif self.options.with_rhg:
3150 rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg))
3151 self._hgcommand = os.path.basename(self.options.with_rhg)
3152
3101 3153 osenvironb[b"BINDIR"] = self._bindir
3102 3154 osenvironb[b"PYTHON"] = PYTHON
3103 3155
@@ -3116,6 +3168,8 b' class TestRunner(object):'
3116 3168 path.insert(2, realdir)
3117 3169 if chgbindir != self._bindir:
3118 3170 path.insert(1, chgbindir)
3171 if rhgbindir != self._bindir:
3172 path.insert(1, rhgbindir)
3119 3173 if self._testdir != runtestdir:
3120 3174 path = [self._testdir] + path
3121 3175 if self._tmpbindir != self._bindir:
@@ -3423,6 +3477,7 b' class TestRunner(object):'
3423 3477 hgcommand=self._hgcommand,
3424 3478 usechg=bool(self.options.with_chg or self.options.chg),
3425 3479 chgdebug=self.options.chg_debug,
3480 rhg_fallback_exe=self._rhg_fallback_exe,
3426 3481 useipv6=useipv6,
3427 3482 **kwds
3428 3483 )
General Comments 0
You need to be logged in to leave comments. Login now