Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_runner.py
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | if args.help: | ||||
[os.path.join(tests_dir, test_list[0]), '-h']) | [os.path.join(tests_dir, test_list[0]), '-h']) | ||||
sys.exit(0) | sys.exit(0) | ||||
if not args.keepcache: | if not args.keepcache: | ||||
shutil.rmtree(os.path.join(build_dir, "test", | shutil.rmtree(os.path.join(build_dir, "test", | ||||
"cache"), ignore_errors=True) | "cache"), ignore_errors=True) | ||||
run_tests(test_list, build_dir, tests_dir, args.junitouput, | run_tests(test_list, build_dir, tests_dir, args.junitouput, | ||||
config["environment"]["EXEEXT"], tmpdir, args.jobs, args.coverage, passon_args, build_timings) | tmpdir, args.jobs, args.coverage, passon_args, build_timings) | ||||
def run_tests(test_list, build_dir, tests_dir, junitouput, exeext, tmpdir, num_jobs, enable_coverage=False, args=[], build_timings=None): | def run_tests(test_list, build_dir, tests_dir, junitouput, tmpdir, num_jobs, enable_coverage=False, args=[], build_timings=None): | ||||
# Warn if bitcoind is already running (unix only) | # Warn if bitcoind is already running (unix only) | ||||
try: | try: | ||||
pidofOutput = subprocess.check_output(["pidof", "bitcoind"]) | pidofOutput = subprocess.check_output(["pidof", "bitcoind"]) | ||||
if pidofOutput is not None and pidofOutput != b'': | if pidofOutput is not None and pidofOutput != b'': | ||||
print("{}WARNING!{} There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!".format( | print("{}WARNING!{} There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!".format( | ||||
BOLD[1], BOLD[0])) | BOLD[1], BOLD[0])) | ||||
except (OSError, subprocess.SubprocessError): | except (OSError, subprocess.SubprocessError): | ||||
pass | pass | ||||
# Warn if there is a cache directory | # Warn if there is a cache directory | ||||
cache_dir = os.path.join(build_dir, "test", "cache") | cache_dir = os.path.join(build_dir, "test", "cache") | ||||
if os.path.isdir(cache_dir): | if os.path.isdir(cache_dir): | ||||
print("{}WARNING!{} There is a cache directory here: {}. If tests fail unexpectedly, try deleting the cache directory.".format( | print("{}WARNING!{} There is a cache directory here: {}. If tests fail unexpectedly, try deleting the cache directory.".format( | ||||
BOLD[1], BOLD[0], cache_dir)) | BOLD[1], BOLD[0], cache_dir)) | ||||
# Set env vars | |||||
if "BITCOIND" not in os.environ: | |||||
os.environ["BITCOIND"] = os.path.join( | |||||
build_dir, 'src', 'bitcoind' + exeext) | |||||
os.environ["BITCOINCLI"] = os.path.join( | |||||
build_dir, 'src', 'bitcoin-cli' + exeext) | |||||
flags = [os.path.join("--srcdir={}".format(build_dir), "src")] + args | flags = [os.path.join("--srcdir={}".format(build_dir), "src")] + args | ||||
flags.append("--cachedir={}".format(cache_dir)) | flags.append("--cachedir={}".format(cache_dir)) | ||||
if enable_coverage: | if enable_coverage: | ||||
coverage = RPCCoverage() | coverage = RPCCoverage() | ||||
flags.append(coverage.flag) | flags.append(coverage.flag) | ||||
logging.debug( | logging.debug( | ||||
"Initializing coverage directory at {}".format(coverage.dir)) | "Initializing coverage directory at {}".format(coverage.dir)) | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |