mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-19 11:18:09 +02:00
Merge bitcoin/bitcoin#32290: test: allow all functional tests to be run or skipped with --usecli
666016e56bci: use --usecli in one of the CI jobs (Martin Zumsande)7ea248a020test: Disable several (sub)tests with cli (Martin Zumsande)f420b6356btest: skip subtests that check for wrong types with cli (Martin Zumsande)6530d0015btest: add function to convert to json for height_or_hash params (Martin Zumsande)54d28722batest: Don't send empty named args with cli (Martin Zumsande)cca422060etest: convert tuple to json for cli (Martin Zumsande)af34e98086test: make rpc_psbt.py usable with --usecli (Martin Zumsande)8f8ce9e174test: rename .rpc to ._rpc and remove unnecessary uses (Martin Zumsande)5b08885986test: enable functional tests with large rpc args for cli (Martin Zumsande)7d5352ac73test: use -stdin for large rpc commands (Martin Zumsande)6c364e0c10test: Enable various tests for usage with cli (Martin Zumsande) Pull request description: Fixes #32264 I looked into all current failures listed in the issue, as well all tests that are already disabled for the cli with `self.supports_cli = False`. There are several reasons why existing tests fail with `--usecli` on many systems, the most important ones are: - Most common reason is that the test executes a RPC call with a large arg that exceeds `MAX_ARG_STRLEN` of the OS, which is usually 128kb on linux: This is fixed by using `-stdin` for these large calls (idea by 0xB10C) - they test specifically the rpc interface - nothing to do there except disabling. - Some functional test submit wrong types to params on purpose to test the error message (which is different when using the cli) - deactivated these specific subtests locally for the cli when there is just one or two of them, deactivated the entire tests when there are more spots - When python sets `None` for an arg, the cli converts this to 'null' in `arg_to_cli`. This is fine e.g. for boolean args, but doesn't work for strings where it's interpreted as the string 'null'. Bypass this for named args by not including args in case the value is `None` for the cli is used (it's effectively the same as leaving the optional arg out). - the `height_or_hash` param used in some RPC needs to be converted to a JSON (effectively adding full quotes). - Some tests were marked with `self.supports_cli = False` in the past but run fine on master today - enabled those. In total, this PR fixes all tests that fail on master and reduces the number of tests that are deactivated (`self.supports_cli = False`) from 40 to 21. It also adds `--usecli` to one CI job (multiprocess, i686, DEBUG) to detect regressions. ACKs for top commit: maflcko: re-ACK666016e56b🔀 pinheadmz: re-ACK666016e56bTree-SHA512: 7a1efd212649ca100b236a1239294d40ecd36e2720e3b173a230b14545bb40b135111db7fed8a0d1448120f5387da146a03f1912e2028c8d03a0b6a3ca8761b0
This commit is contained in:
@@ -8,6 +8,7 @@ import configparser
|
||||
from enum import Enum
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
@@ -595,7 +596,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
node.wait_for_rpc_connection()
|
||||
|
||||
if self.options.coveragedir is not None:
|
||||
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc)
|
||||
coverage.write_all_rpc_commands(self.options.coveragedir, node._rpc)
|
||||
|
||||
def start_nodes(self, extra_args=None, *args, **kwargs):
|
||||
"""Start multiple bitcoinds"""
|
||||
@@ -610,7 +611,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
if self.options.coveragedir is not None:
|
||||
for node in self.nodes:
|
||||
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc)
|
||||
coverage.write_all_rpc_commands(self.options.coveragedir, node._rpc)
|
||||
|
||||
def stop_node(self, i, expected_stderr='', wait=0):
|
||||
"""Stop a bitcoind test node"""
|
||||
@@ -1083,3 +1084,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
def has_blockfile(self, node, filenum: str):
|
||||
return (node.blocks_path/ f"blk{filenum}.dat").is_file()
|
||||
|
||||
def convert_to_json_for_cli(self, text):
|
||||
if self.options.usecli:
|
||||
return json.dumps(text)
|
||||
return text
|
||||
|
||||
Reference in New Issue
Block a user