Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | class TestNode(): | ||||
- a Python subprocess.Popen object representing the running process | - a Python subprocess.Popen object representing the running process | ||||
- an RPC connection to the node | - an RPC connection to the node | ||||
- one or more P2P connections to the node | - one or more P2P connections to the node | ||||
To make things easier for the test writer, any unrecognised messages will | To make things easier for the test writer, any unrecognised messages will | ||||
be dispatched to the RPC connection.""" | be dispatched to the RPC connection.""" | ||||
def __init__(self, i, datadir, *, chain, host, rpc_port, p2p_port, timewait, bitcoind, bitcoin_cli, | def __init__(self, i, datadir, *, chain, host, rpc_port, p2p_port, timewait, bitcoind, bitcoin_cli, | ||||
coverage_dir, cwd, extra_conf=None, extra_args=None, use_cli=False, emulator=None, start_perf=False): | coverage_dir, cwd, extra_conf=None, extra_args=None, use_cli=False, emulator=None, start_perf=False, use_valgrind=False): | ||||
""" | """ | ||||
Kwargs: | Kwargs: | ||||
start_perf (bool): If True, begin profiling the node with `perf` as soon as | start_perf (bool): If True, begin profiling the node with `perf` as soon as | ||||
the node starts. | the node starts. | ||||
""" | """ | ||||
self.index = i | self.index = i | ||||
self.datadir = datadir | self.datadir = datadir | ||||
Show All 30 Lines | def __init__(self, i, datadir, *, chain, host, rpc_port, p2p_port, timewait, bitcoind, bitcoin_cli, | ||||
"-logthreadnames", | "-logthreadnames", | ||||
"-debug", | "-debug", | ||||
"-debugexclude=libevent", | "-debugexclude=libevent", | ||||
"-debugexclude=leveldb", | "-debugexclude=leveldb", | ||||
"-uacomment=" + self.name, | "-uacomment=" + self.name, | ||||
"-noprinttoconsole", | "-noprinttoconsole", | ||||
] | ] | ||||
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.binary = "valgrind" | |||||
self.bitcoind_args = [bitcoind] + self.default_args | |||||
self.default_args = ["--suppressions={}".format(suppressions_file), | |||||
"--gen-suppressions=all", "--exit-on-first-error=yes", | |||||
"--error-exitcode=1", "--quiet"] + self.bitcoind_args | |||||
if emulator is not None: | if emulator is not None: | ||||
if not os.path.isfile(emulator): | if not os.path.isfile(emulator): | ||||
raise FileNotFoundError( | raise FileNotFoundError( | ||||
"Emulator '{}' could not be found.".format(emulator)) | "Emulator '{}' could not be found.".format(emulator)) | ||||
self.emulator = emulator | self.emulator = emulator | ||||
if use_cli and not os.path.isfile(bitcoin_cli): | if use_cli and not os.path.isfile(bitcoin_cli): | ||||
raise FileNotFoundError( | raise FileNotFoundError( | ||||
▲ Show 20 Lines • Show All 597 Lines • Show Last 20 Lines |