Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | def main(self): | ||||
parser.add_argument("--coveragedir", dest="coveragedir", | parser.add_argument("--coveragedir", dest="coveragedir", | ||||
help="Write tested RPC commands into this directory") | help="Write tested RPC commands into this directory") | ||||
parser.add_argument("--configfile", dest="configfile", default=os.path.abspath(os.path.dirname(os.path.realpath( | parser.add_argument("--configfile", dest="configfile", default=os.path.abspath(os.path.dirname(os.path.realpath( | ||||
__file__)) + "/../../config.ini"), help="Location of the test framework config file (default: %(default)s)") | __file__)) + "/../../config.ini"), help="Location of the test framework config file (default: %(default)s)") | ||||
parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", | parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", | ||||
help="Attach a python debugger if test fails") | help="Attach a python debugger if test fails") | ||||
parser.add_argument("--usecli", dest="usecli", default=False, action="store_true", | parser.add_argument("--usecli", dest="usecli", default=False, action="store_true", | ||||
help="use bitcoin-cli instead of RPC for all commands") | help="use bitcoin-cli instead of RPC for all commands") | ||||
parser.add_argument("--with-gravitonactivation", dest="gravitonactivation", default=False, action="store_true", | parser.add_argument("--with-nextupgrade", dest="nextupgrade", default=False, action="store_true", | ||||
help="Activate graviton update on timestamp {}".format(TIMESTAMP_IN_THE_PAST)) | help="Activate the next upgrade") | ||||
self.add_options(parser) | self.add_options(parser) | ||||
self.options = parser.parse_args() | self.options = parser.parse_args() | ||||
self.set_test_params() | self.set_test_params() | ||||
assert hasattr( | assert hasattr( | ||||
self, "num_nodes"), "Test must set self.num_nodes in set_test_params()" | self, "num_nodes"), "Test must set self.num_nodes in set_test_params()" | ||||
PortSeed.n = self.options.port_seed | PortSeed.n = self.options.port_seed | ||||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None): | ||||
bitcoind=binary[i], | bitcoind=binary[i], | ||||
bitcoin_cli=self.options.bitcoincli, | bitcoin_cli=self.options.bitcoincli, | ||||
mocktime=self.mocktime, | mocktime=self.mocktime, | ||||
coverage_dir=self.options.coveragedir, | coverage_dir=self.options.coveragedir, | ||||
extra_conf=extra_confs[i], | extra_conf=extra_confs[i], | ||||
extra_args=extra_args[i], | extra_args=extra_args[i], | ||||
use_cli=self.options.usecli, | use_cli=self.options.usecli, | ||||
)) | )) | ||||
if self.options.gravitonactivation: | if self.options.nextupgrade: | ||||
self.nodes[i].extend_default_args( | self.nodes[i].extend_default_args(["-activatenextupgrade=1"]) | ||||
["-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] | ||||
node.start(*args, **kwargs) | node.start(*args, **kwargs) | ||||
node.wait_for_rpc_connection() | node.wait_for_rpc_connection() | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | def _initialize_chain(self): | ||||
coverage_dir=None | coverage_dir=None | ||||
)) | )) | ||||
self.nodes[i].clear_default_args() | self.nodes[i].clear_default_args() | ||||
self.nodes[i].extend_default_args(["-datadir=" + datadir]) | self.nodes[i].extend_default_args(["-datadir=" + datadir]) | ||||
self.nodes[i].extend_default_args(["-disablewallet"]) | self.nodes[i].extend_default_args(["-disablewallet"]) | ||||
if i > 0: | if i > 0: | ||||
self.nodes[i].extend_default_args( | self.nodes[i].extend_default_args( | ||||
["-connect=127.0.0.1:" + str(p2p_port(0))]) | ["-connect=127.0.0.1:" + str(p2p_port(0))]) | ||||
if self.options.gravitonactivation: | if self.options.nextupgrade: | ||||
self.nodes[i].extend_default_args( | self.nodes[i].extend_default_args( | ||||
["-gravitonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ["-activatenextupgrade=1"]) | ||||
self.start_node(i) | self.start_node(i) | ||||
# Wait for RPC connections to be ready | # Wait for RPC connections to be ready | ||||
for node in self.nodes: | for node in self.nodes: | ||||
node.wait_for_rpc_connection() | node.wait_for_rpc_connection() | ||||
# For backward compatibility of the python scripts with previous | # For backward compatibility of the python scripts with previous | ||||
# versions of the cache, set mocktime to Jan 1, | # versions of the cache, set mocktime to Jan 1, | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |