Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | def main(self): | ||||
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-phononactivation", dest="phononactivation", default=False, action="store_true", | parser.add_argument("--with-phononactivation", dest="phononactivation", default=False, action="store_true", | ||||
help="Activate phonon update on timestamp {}".format(TIMESTAMP_IN_THE_PAST)) | help="Activate phonon update on timestamp {}".format(TIMESTAMP_IN_THE_PAST)) | ||||
parser.add_argument("--with-axionactivation", dest="axionactivation", default=False, action="store_true", | |||||
help="Activate axion update on timestamp {}".format(TIMESTAMP_IN_THE_PAST)) | |||||
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 210 Lines • ▼ Show 20 Lines | def add_nodes(self, num_nodes, extra_args=None, | ||||
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, | ||||
emulator=self.options.emulator, | emulator=self.options.emulator, | ||||
)) | )) | ||||
if self.options.phononactivation: | if self.options.phononactivation: | ||||
self.nodes[i].extend_default_args( | self.nodes[i].extend_default_args( | ||||
["-phononactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ["-phononactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ||||
if self.options.axionactivation: | |||||
self.nodes[i].extend_default_args( | |||||
["-axionactivationtime={}".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): | ||||
bitcoin_cli=self.options.bitcoincli, | bitcoin_cli=self.options.bitcoincli, | ||||
coverage_dir=None, | coverage_dir=None, | ||||
emulator=self.options.emulator, | emulator=self.options.emulator, | ||||
)) | )) | ||||
if self.options.phononactivation: | if self.options.phononactivation: | ||||
self.nodes[CACHE_NODE_ID].extend_default_args( | self.nodes[CACHE_NODE_ID].extend_default_args( | ||||
["-phononactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ["-phononactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | ||||
if self.options.axionactivation: | |||||
self.nodes[CACHE_NODE_ID].extend_default_args( | |||||
["-axionactivationtime={}".format(TIMESTAMP_IN_THE_PAST)]) | |||||
self.start_node(CACHE_NODE_ID) | self.start_node(CACHE_NODE_ID) | ||||
cache_node = self.nodes[CACHE_NODE_ID] | cache_node = self.nodes[CACHE_NODE_ID] | ||||
# Wait for RPC connections to be ready | # Wait for RPC connections to be ready | ||||
cache_node.wait_for_rpc_connection() | cache_node.wait_for_rpc_connection() | ||||
# Set a time in the past, so that blocks don't end up in the future | # Set a time in the past, so that blocks don't end up in the future | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |