##// END OF EJS Templates
run-tests: add option for running with and without Rust extensions...
Raphaël Gomès -
r44973:9183b7dc default
parent child Browse files
Show More
@@ -53,6 +53,7 b' import errno'
53 import json
53 import json
54 import multiprocessing
54 import multiprocessing
55 import os
55 import os
56 import platform
56 import random
57 import random
57 import re
58 import re
58 import shutil
59 import shutil
@@ -555,6 +556,16 b' def getparser():'
555 help="use pure Python code instead of C extensions",
556 help="use pure Python code instead of C extensions",
556 )
557 )
557 hgconf.add_argument(
558 hgconf.add_argument(
559 "--rust",
560 action="store_true",
561 help="use Rust code alongside C extensions",
562 )
563 hgconf.add_argument(
564 "--no-rust",
565 action="store_true",
566 help="do not use Rust code even if compiled",
567 )
568 hgconf.add_argument(
558 "--with-chg",
569 "--with-chg",
559 metavar="CHG",
570 metavar="CHG",
560 help="use specified chg wrapper in place of hg",
571 help="use specified chg wrapper in place of hg",
@@ -637,6 +648,15 b' def parseargs(args, parser):'
637 if 'java' in sys.platform or '__pypy__' in sys.modules:
648 if 'java' in sys.platform or '__pypy__' in sys.modules:
638 options.pure = True
649 options.pure = True
639
650
651 if platform.python_implementation() != 'CPython' and options.rust:
652 parser.error('Rust extensions are only available with CPython')
653
654 if options.pure and options.rust:
655 parser.error('--rust cannot be used with --pure')
656
657 if options.rust and options.no_rust:
658 parser.error('--rust cannot be used with --no-rust')
659
640 if options.local:
660 if options.local:
641 if options.with_hg or options.with_chg:
661 if options.with_hg or options.with_chg:
642 parser.error('--local cannot be used with --with-hg or --with-chg')
662 parser.error('--local cannot be used with --with-hg or --with-chg')
@@ -3093,6 +3113,13 b' class TestRunner(object):'
3093 if self.options.pure:
3113 if self.options.pure:
3094 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure"
3114 os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure"
3095 os.environ["HGMODULEPOLICY"] = "py"
3115 os.environ["HGMODULEPOLICY"] = "py"
3116 if self.options.rust:
3117 os.environ["HGMODULEPOLICY"] = "rust+c"
3118 if self.options.no_rust:
3119 current_policy = os.environ.get("HGMODULEPOLICY", "")
3120 if current_policy.startswith("rust+"):
3121 os.environ["HGMODULEPOLICY"] = current_policy[len("rust+") :]
3122 os.environ.pop("HGWITHRUSTEXT", None)
3096
3123
3097 if self.options.allow_slow_tests:
3124 if self.options.allow_slow_tests:
3098 os.environ["HGTEST_SLOW"] = "slow"
3125 os.environ["HGTEST_SLOW"] = "slow"
@@ -3426,6 +3453,10 b' class TestRunner(object):'
3426 setup_opts = b""
3453 setup_opts = b""
3427 if self.options.pure:
3454 if self.options.pure:
3428 setup_opts = b"--pure"
3455 setup_opts = b"--pure"
3456 elif self.options.rust:
3457 setup_opts = b"--rust"
3458 elif self.options.no_rust:
3459 setup_opts = b"--no-rust"
3429
3460
3430 # Run installer in hg root
3461 # Run installer in hg root
3431 script = os.path.realpath(sys.argv[0])
3462 script = os.path.realpath(sys.argv[0])
General Comments 0
You need to be logged in to leave comments. Login now