Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_runner.py
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | def main(): | ||||
parser.add_argument('--quiet', '-q', action='store_true', | parser.add_argument('--quiet', '-q', action='store_true', | ||||
help='only print results summary and failure logs') | help='only print results summary and failure logs') | ||||
parser.add_argument('--tmpdirprefix', '-t', | parser.add_argument('--tmpdirprefix', '-t', | ||||
default=os.path.join(build_dir, 'test', 'tmp'), help="Root directory for datadirs") | default=os.path.join(build_dir, 'test', 'tmp'), help="Root directory for datadirs") | ||||
parser.add_argument( | parser.add_argument( | ||||
'--failfast', | '--failfast', | ||||
action='store_true', | action='store_true', | ||||
help='stop execution after the first test failure') | help='stop execution after the first test failure') | ||||
parser.add_argument('--junitoutput', '-J', default='junit_results.xml', | parser.add_argument('--junitoutput', '-J', | ||||
help="File that will store JUnit formatted test results. If no absolute path is given it is treated as relative to the temporary directory.") | help="File that will store JUnit formatted test results. If no absolute path is given it is treated as relative to the temporary directory.") | ||||
parser.add_argument('--testsuitename', '-n', default='Bitcoin ABC functional tests', | parser.add_argument('--testsuitename', '-n', default='Bitcoin ABC functional tests', | ||||
help="Name of the test suite, as it will appear in the logs and in the JUnit report.") | help="Name of the test suite, as it will appear in the logs and in the JUnit report.") | ||||
args, unknown_args = parser.parse_known_args() | args, unknown_args = parser.parse_known_args() | ||||
# args to be passed on always start with two dashes; tests are the | # args to be passed on always start with two dashes; tests are the | ||||
# remaining unknown args | # remaining unknown args | ||||
tests = [arg for arg in unknown_args if arg[:2] != "--"] | tests = [arg for arg in unknown_args if arg[:2] != "--"] | ||||
Show All 14 Lines | def main(): | ||||
if config["environment"]["EXEEXT"] == ".exe": | if config["environment"]["EXEEXT"] == ".exe": | ||||
tmpdir = os.path.join("{}", "test_runner_{:%Y%m%d_%H%M%S}").format( | tmpdir = os.path.join("{}", "test_runner_{:%Y%m%d_%H%M%S}").format( | ||||
args.tmpdirprefix, datetime.datetime.now()) | args.tmpdirprefix, datetime.datetime.now()) | ||||
os.makedirs(tmpdir) | os.makedirs(tmpdir) | ||||
logging.debug("Temporary test directory at {}".format(tmpdir)) | logging.debug("Temporary test directory at {}".format(tmpdir)) | ||||
if not os.path.isabs(args.junitoutput): | if args.junitoutput and not os.path.isabs(args.junitoutput): | ||||
args.junitoutput = os.path.join(tmpdir, args.junitoutput) | args.junitoutput = os.path.join(tmpdir, args.junitoutput) | ||||
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND") | enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND") | ||||
if config["environment"]["EXEEXT"] == ".exe" and not args.force: | if config["environment"]["EXEEXT"] == ".exe" and not args.force: | ||||
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 | # https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 | ||||
# https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964 | # https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964 | ||||
print( | print( | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | def run_tests(test_list, build_dir, tests_dir, junitoutput, tmpdir, num_jobs, test_suite_name, | ||||
time0 = time.time() | time0 = time.time() | ||||
test_results = execute_test_processes( | test_results = execute_test_processes( | ||||
num_jobs, test_list, tests_dir, tmpdir, flags, failfast) | num_jobs, test_list, tests_dir, tmpdir, flags, failfast) | ||||
runtime = time.time() - time0 | runtime = time.time() - time0 | ||||
max_len_name = len(max(test_list, key=len)) | max_len_name = len(max(test_list, key=len)) | ||||
print_results(test_results, tests_dir, max_len_name, | print_results(test_results, tests_dir, max_len_name, | ||||
runtime, combined_logs_len) | runtime, combined_logs_len) | ||||
save_results_as_junit(test_results, junitoutput, runtime, test_suite_name) | |||||
if junitoutput is not None: | |||||
save_results_as_junit( | |||||
test_results, | |||||
junitoutput, | |||||
runtime, | |||||
test_suite_name) | |||||
if (build_timings is not None): | if (build_timings is not None): | ||||
build_timings.save_timings(test_results) | build_timings.save_timings(test_results) | ||||
if coverage: | if coverage: | ||||
coverage_passed = coverage.report_rpc_coverage() | coverage_passed = coverage.report_rpc_coverage() | ||||
logging.debug("Cleaning up coverage data") | logging.debug("Cleaning up coverage data") | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |