Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2016 The Bitcoin Core developers | # Copyright (c) 2014-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# Base class for RPC testing | |||||
from collections import deque | from collections import deque | ||||
from enum import Enum | from enum import Enum | ||||
import logging | import logging | ||||
import optparse | import optparse | ||||
import os | import os | ||||
import shutil | import shutil | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | def main(self): | ||||
if not os.listdir(self.options.root): | if not os.listdir(self.options.root): | ||||
os.rmdir(self.options.root) | os.rmdir(self.options.root) | ||||
else: | else: | ||||
self.log.warning("Not cleaning up dir %s" % self.options.tmpdir) | self.log.warning("Not cleaning up dir %s" % self.options.tmpdir) | ||||
if os.getenv("PYTHON_DEBUG", ""): | if os.getenv("PYTHON_DEBUG", ""): | ||||
# Dump the end of the debug logs, to aid in debugging rare | # Dump the end of the debug logs, to aid in debugging rare | ||||
# travis failures. | # travis failures. | ||||
import glob | import glob | ||||
filenames = glob.glob( | filenames = [self.options.tmpdir + "/test_framework.log"] | ||||
self.options.tmpdir + "/node*/regtest/debug.log") | filenames += glob.glob(self.options.tmpdir + | ||||
"/node*/regtest/debug.log") | |||||
MAX_LINES_TO_PRINT = 1000 | MAX_LINES_TO_PRINT = 1000 | ||||
for fn in filenames: | for fn in filenames: | ||||
try: | try: | ||||
with open(fn, 'r') as f: | with open(fn, 'r') as f: | ||||
print("From", fn, ":") | print("From", fn, ":") | ||||
print("".join(deque(f, MAX_LINES_TO_PRINT))) | print("".join(deque(f, MAX_LINES_TO_PRINT))) | ||||
except OSError: | except OSError: | ||||
print("Opening file %s failed." % fn) | print("Opening file %s failed." % fn) | ||||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |