From dcd28c8d26c5c462045c0d51e89f4215d5f85cce Mon Sep 17 00:00:00 2001 From: Brandon Odiwuor Date: Mon, 5 Feb 2024 21:10:33 +0300 Subject: [PATCH] test: fix RPC coverage check --- test/functional/create_cache.py | 3 +++ test/functional/test_framework/test_framework.py | 2 +- test/functional/test_runner.py | 9 +++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/functional/create_cache.py b/test/functional/create_cache.py index 1108a8e3544be..609e6f3f36ce2 100755 --- a/test/functional/create_cache.py +++ b/test/functional/create_cache.py @@ -14,6 +14,9 @@ class CreateCache(BitcoinTestFramework): # Test network and test nodes are not required: + def add_options(self, parser): + self.add_wallet_options(parser) + def set_test_params(self): self.num_nodes = 0 diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index a2f767cc9898c..3e52433cfdb2e 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -829,7 +829,7 @@ def _initialize_chain(self): cache_node_dir, chain=self.chain, extra_conf=["bind=127.0.0.1"], - extra_args=['-disablewallet'], + extra_args=[], rpchost=None, timewait=self.rpc_timeout, timeout_factor=self.options.timeout_factor, diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index f6eccab2b372a..e0ceb9fb15f78 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -424,6 +424,7 @@ def main(): parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs") parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure') parser.add_argument('--filter', help='filter scripts to run by regular expression') + parser.add_argument("--legacy-wallet", action='store_const', const=False, help="Run test using legacy wallets", dest='legacy_wallet') args, unknown_args = parser.parse_known_args() @@ -535,9 +536,10 @@ def main(): combined_logs_len=args.combinedlogslen, failfast=args.failfast, use_term_control=args.ansi, + legacy=args.legacy_wallet, ) -def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control): +def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, legacy=False): args = args or [] # Warn if bitcoind is already running @@ -572,7 +574,10 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage= if len(test_list) > 1 and jobs > 1: # Populate cache try: - subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + ["--tmpdir=%s/cache" % tmpdir]) + # Disable '--descriptors' flag on create_cache if '--legacy-wallet' flag is provided + wallet_flag = '--legacy-wallet' if legacy else '--descriptors' + + subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + [f"--tmpdir={tmpdir}/cache", wallet_flag]) except subprocess.CalledProcessError as e: sys.stdout.buffer.write(e.output) raise