Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | def main(self, args=None): | ||||
# Set up temp directory and start logging | # Set up temp directory and start logging | ||||
if self.options.tmpdir: | if self.options.tmpdir: | ||||
self.options.tmpdir = os.path.abspath(self.options.tmpdir) | self.options.tmpdir = os.path.abspath(self.options.tmpdir) | ||||
os.makedirs(self.options.tmpdir, exist_ok=False) | os.makedirs(self.options.tmpdir, exist_ok=False) | ||||
else: | else: | ||||
self.options.tmpdir = tempfile.mkdtemp(prefix="test") | self.options.tmpdir = tempfile.mkdtemp(prefix="test") | ||||
self._start_logging() | self._start_logging() | ||||
print(self.options.tmpdir) | |||||
success = TestStatus.FAILED | success = TestStatus.FAILED | ||||
try: | try: | ||||
self.setup_chain() | self.setup_chain() | ||||
self.setup_network() | self.setup_network() | ||||
self.run_test() | self.run_test() | ||||
success = TestStatus.PASSED | success = TestStatus.PASSED | ||||
except JSONRPCException as e: | except JSONRPCException as e: | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | def _initialize_chain(self): | ||||
for i in range(MAX_NODES): | for i in range(MAX_NODES): | ||||
os.remove(log_filename(self.options.cachedir, i, "debug.log")) | os.remove(log_filename(self.options.cachedir, i, "debug.log")) | ||||
os.remove(log_filename(self.options.cachedir, i, "db.log")) | os.remove(log_filename(self.options.cachedir, i, "db.log")) | ||||
os.remove(log_filename(self.options.cachedir, i, "peers.dat")) | os.remove(log_filename(self.options.cachedir, i, "peers.dat")) | ||||
os.remove(log_filename( | os.remove(log_filename( | ||||
self.options.cachedir, i, "fee_estimates.dat")) | self.options.cachedir, i, "fee_estimates.dat")) | ||||
for i in range(self.num_nodes): | for i in range(self.num_nodes): | ||||
print("Why Initialiation faile?", self.options.tmpdir) | |||||
from_dir = os.path.join(self.options.cachedir, "node" + str(i)) | from_dir = os.path.join(self.options.cachedir, "node" + str(i)) | ||||
to_dir = os.path.join(self.options.tmpdir, "node" + str(i)) | to_dir = os.path.join(self.options.tmpdir, "node" + str(i)) | ||||
shutil.copytree(from_dir, to_dir) | shutil.copytree(from_dir, to_dir) | ||||
# Overwrite port/rpcport in bitcoin.conf | # Overwrite port/rpcport in bitcoin.conf | ||||
initialize_datadir(self.options.tmpdir, i, | initialize_datadir(self.options.tmpdir, i, | ||||
self.p2p_port(i), self.rpc_port(i)) | self.p2p_port(i), self.rpc_port(i)) | ||||
def _initialize_chain_clean(self): | def _initialize_chain_clean(self): | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |