mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
tests: Add option --valgrind to run nodes under valgrind in the functional tests
This commit is contained in:
parent
19698ac6bc
commit
5db506ba59
2 changed files with 13 additions and 1 deletions
|
@ -157,6 +157,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
help="use bitcoin-cli instead of RPC for all commands")
|
||||
parser.add_argument("--perf", dest="perf", default=False, action="store_true",
|
||||
help="profile running nodes with perf for the duration of the test")
|
||||
parser.add_argument("--valgrind", dest="valgrind", default=False, action="store_true",
|
||||
help="run nodes under the valgrind memory error detector: expect at least a ~10x slowdown, valgrind 3.14 or later required")
|
||||
parser.add_argument("--randomseed", type=int,
|
||||
help="set a random seed for deterministically reproducing a previous test run")
|
||||
self.add_options(parser)
|
||||
|
@ -394,6 +396,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
extra_args=extra_args[i],
|
||||
use_cli=self.options.usecli,
|
||||
start_perf=self.options.perf,
|
||||
use_valgrind=self.options.valgrind,
|
||||
))
|
||||
|
||||
def start_node(self, i, *args, **kwargs):
|
||||
|
|
|
@ -59,7 +59,7 @@ class TestNode():
|
|||
To make things easier for the test writer, any unrecognised messages will
|
||||
be dispatched to the RPC connection."""
|
||||
|
||||
def __init__(self, i, datadir, *, chain, rpchost, timewait, bitcoind, bitcoin_cli, coverage_dir, cwd, extra_conf=None, extra_args=None, use_cli=False, start_perf=False):
|
||||
def __init__(self, i, datadir, *, chain, rpchost, timewait, bitcoind, bitcoin_cli, coverage_dir, cwd, extra_conf=None, extra_args=None, use_cli=False, start_perf=False, use_valgrind=False):
|
||||
"""
|
||||
Kwargs:
|
||||
start_perf (bool): If True, begin profiling the node with `perf` as soon as
|
||||
|
@ -96,6 +96,15 @@ class TestNode():
|
|||
"-debugexclude=leveldb",
|
||||
"-uacomment=testnode%d" % i,
|
||||
]
|
||||
if use_valgrind:
|
||||
default_suppressions_file = os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)),
|
||||
"..", "..", "..", "contrib", "valgrind.supp")
|
||||
suppressions_file = os.getenv("VALGRIND_SUPPRESSIONS_FILE",
|
||||
default_suppressions_file)
|
||||
self.args = ["valgrind", "--suppressions={}".format(suppressions_file),
|
||||
"--gen-suppressions=all", "--exit-on-first-error=yes",
|
||||
"--error-exitcode=1", "--quiet"] + self.args
|
||||
|
||||
self.cli = TestNodeCLI(bitcoin_cli, self.datadir)
|
||||
self.use_cli = use_cli
|
||||
|
|
Loading…
Add table
Reference in a new issue