Browse Source

Print out the final 1000 lines of test_framework.log if test fails

0.15
John Newbery 8 years ago
parent
commit
8c7288c06b
  1. 16
      test/functional/test_framework/test_framework.py

16
test/functional/test_framework/test_framework.py

@ -4,6 +4,7 @@
# 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.""" """Base class for RPC testing."""
from collections import deque
import logging import logging
import optparse import optparse
import os import os
@ -177,12 +178,17 @@ class BitcoinTestFramework(object):
# 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(self.options.tmpdir + "/node*/regtest/debug.log") filenames = [self.options.tmpdir + "/test_framework.log"]
filenames += glob.glob(self.options.tmpdir + "/node*/regtest/debug.log")
MAX_LINES_TO_PRINT = 1000 MAX_LINES_TO_PRINT = 1000
for f in filenames: for fn in filenames:
print("From" , f, ":") try:
from collections import deque with open(fn, 'r') as f:
print("".join(deque(open(f), MAX_LINES_TO_PRINT))) print("From" , fn, ":")
print("".join(deque(f, MAX_LINES_TO_PRINT)))
except OSError:
print("Opening file %s failed." % fn)
traceback.print_exc()
if success: if success:
self.log.info("Tests successful") self.log.info("Tests successful")
sys.exit(self.TEST_EXIT_PASSED) sys.exit(self.TEST_EXIT_PASSED)

Loading…
Cancel
Save