Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | class BitcoinTestFramework(): | ||||
def run_test(self): | def run_test(self): | ||||
"""Tests must override this method to define test logic""" | """Tests must override this method to define test logic""" | ||||
raise NotImplementedError | raise NotImplementedError | ||||
# Public helper methods. These can be accessed by the subclass test scripts. | # Public helper methods. These can be accessed by the subclass test scripts. | ||||
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None): | def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None): | ||||
"""Instantiate TestNode objects""" | """Instantiate TestNode objects. | ||||
Should only be called once after the nodes have been specified in | |||||
set_test_params().""" | |||||
if self.bind_to_localhost_only: | if self.bind_to_localhost_only: | ||||
extra_confs = [["bind=127.0.0.1"]] * num_nodes | extra_confs = [["bind=127.0.0.1"]] * num_nodes | ||||
else: | else: | ||||
extra_confs = [[]] * num_nodes | extra_confs = [[]] * num_nodes | ||||
if extra_args is None: | if extra_args is None: | ||||
extra_args = [[]] * num_nodes | extra_args = [[]] * num_nodes | ||||
if binary is None: | if binary is None: | ||||
binary = [self.options.bitcoind] * num_nodes | binary = [self.options.bitcoind] * num_nodes | ||||
assert_equal(len(extra_confs), num_nodes) | assert_equal(len(extra_confs), num_nodes) | ||||
assert_equal(len(extra_args), num_nodes) | assert_equal(len(extra_args), num_nodes) | ||||
assert_equal(len(binary), num_nodes) | assert_equal(len(binary), num_nodes) | ||||
for i in range(num_nodes): | for i in range(num_nodes): | ||||
self.nodes.append(TestNode(i, get_datadir_path(self.options.tmpdir, i), host=rpchost, rpc_port=rpc_port(i), p2p_port=p2p_port(i), timewait=self.rpc_timewait, | self.nodes.append(TestNode( | ||||
bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli)) | i, | ||||
get_datadir_path(self.options.tmpdir, i), | |||||
host=rpchost, | |||||
rpc_port=rpc_port(i), | |||||
p2p_port=p2p_port(i), | |||||
timewait=self.rpc_timewait, | |||||
bitcoind=binary[i], | |||||
bitcoin_cli=self.options.bitcoincli, | |||||
mocktime=self.mocktime, | |||||
coverage_dir=self.options.coveragedir, | |||||
extra_conf=extra_confs[i], | |||||
extra_args=extra_args[i], | |||||
use_cli=self.options.usecli, | |||||
)) | |||||
if self.options.gravitonactivation: | if self.options.gravitonactivation: | ||||
self.nodes[i].extend_default_args( | self.nodes[i].extend_default_args( | ||||
["-gravitonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ["-gravitonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ||||
def start_node(self, i, *args, **kwargs): | def start_node(self, i, *args, **kwargs): | ||||
"""Start a bitcoind""" | """Start a bitcoind""" | ||||
node = self.nodes[i] | node = self.nodes[i] | ||||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |