mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #9780: Suppress noisy output from qa tests in Travis
8c7288c
Print out the final 1000 lines of test_framework.log if test fails (John Newbery)6d780b1
Update travis config to run rpc-tests.py in quiet mode (John Newbery)55992f1
Add --quiet option to suppress rpc-tests.py output (John Newbery) Tree-SHA512: ab080458a07a9346d3b3cbc8ab59b73cea3d4010b1cb0206bb5fade0aaac7562c623475d0a02993f001b22ae9d1ba68e2d0d1a3645cea7e79cc1045b42e2ce3a
This commit is contained in:
parent
98f3e295cc
commit
9c863edd9c
@ -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
|
||||||
@ -196,12 +197,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)
|
||||||
|
@ -23,6 +23,7 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import re
|
import re
|
||||||
|
import logging
|
||||||
|
|
||||||
TEST_EXIT_PASSED = 0
|
TEST_EXIT_PASSED = 0
|
||||||
TEST_EXIT_SKIPPED = 77
|
TEST_EXIT_SKIPPED = 77
|
||||||
@ -160,6 +161,7 @@ def main():
|
|||||||
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
||||||
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
||||||
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
||||||
|
parser.add_argument('--quiet', '-q', action='store_true', help='only print results summary and failure logs')
|
||||||
parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
|
parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
|
||||||
@ -171,6 +173,10 @@ def main():
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read_file(open(os.path.dirname(__file__) + "/config.ini"))
|
config.read_file(open(os.path.dirname(__file__) + "/config.ini"))
|
||||||
|
|
||||||
|
# Set up logging
|
||||||
|
logging_level = logging.INFO if args.quiet else logging.DEBUG
|
||||||
|
logging.basicConfig(format='%(message)s', level=logging_level)
|
||||||
|
|
||||||
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
|
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
|
||||||
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
||||||
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
||||||
@ -257,7 +263,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
|
|||||||
if enable_coverage:
|
if enable_coverage:
|
||||||
coverage = RPCCoverage()
|
coverage = RPCCoverage()
|
||||||
flags.append(coverage.flag)
|
flags.append(coverage.flag)
|
||||||
print("Initializing coverage directory at %s\n" % coverage.dir)
|
logging.debug("Initializing coverage directory at %s" % coverage.dir)
|
||||||
else:
|
else:
|
||||||
coverage = None
|
coverage = None
|
||||||
|
|
||||||
@ -273,16 +279,20 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
|
|||||||
job_queue = TestHandler(jobs, tests_dir, test_list, flags)
|
job_queue = TestHandler(jobs, tests_dir, test_list, flags)
|
||||||
|
|
||||||
max_len_name = len(max(test_list, key=len))
|
max_len_name = len(max(test_list, key=len))
|
||||||
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0]
|
results = "\n" + BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0]
|
||||||
for _ in range(len(test_list)):
|
for _ in range(len(test_list)):
|
||||||
(name, stdout, stderr, status, duration) = job_queue.get_next()
|
(name, stdout, stderr, status, duration) = job_queue.get_next()
|
||||||
all_passed = all_passed and status != "Failed"
|
all_passed = all_passed and status != "Failed"
|
||||||
time_sum += duration
|
time_sum += duration
|
||||||
|
|
||||||
print('\n' + BOLD[1] + name + BOLD[0] + ":")
|
if status == "Passed":
|
||||||
print('' if status == "Passed" else stdout + '\n', end='')
|
logging.debug("\n%s%s%s passed, Duration: %s s" % (BOLD[1], name, BOLD[0], duration))
|
||||||
print('' if stderr == '' else 'stderr:\n' + stderr + '\n', end='')
|
elif status == "Skipped":
|
||||||
print("Status: %s%s%s, Duration: %s s\n" % (BOLD[1], status, BOLD[0], duration))
|
logging.debug("\n%s%s%s skipped" % (BOLD[1], name, BOLD[0]))
|
||||||
|
else:
|
||||||
|
print("\n%s%s%s failed, Duration: %s s\n" % (BOLD[1], name, BOLD[0], duration))
|
||||||
|
print(BOLD[1] + 'stdout:\n' + BOLD[0] + stdout + '\n')
|
||||||
|
print(BOLD[1] + 'stderr:\n' + BOLD[0] + stderr + '\n')
|
||||||
|
|
||||||
results += "%s | %s | %s s\n" % (name.ljust(max_len_name), status.ljust(7), duration)
|
results += "%s | %s | %s s\n" % (name.ljust(max_len_name), status.ljust(7), duration)
|
||||||
|
|
||||||
@ -293,7 +303,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
|
|||||||
if coverage:
|
if coverage:
|
||||||
coverage.report_rpc_coverage()
|
coverage.report_rpc_coverage()
|
||||||
|
|
||||||
print("Cleaning up coverage data")
|
logging.debug("Cleaning up coverage data")
|
||||||
coverage.cleanup()
|
coverage.cleanup()
|
||||||
|
|
||||||
sys.exit(not all_passed)
|
sys.exit(not all_passed)
|
||||||
|
Loading…
Reference in New Issue
Block a user