diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index cef49a3845e..6cf4aa92116 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -415,7 +415,6 @@ def main(): parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests') 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('--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('--quiet', '-q', action='store_true', help='only print dots, results summary and failure logs') parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs") parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure') @@ -565,9 +564,6 @@ def main(): check_script_list(src_dir=config["environment"]["SRCDIR"], fail_on_warn=fail_on_warn) check_script_prefixes() - if not args.keepcache: - shutil.rmtree("%s/test/cache" % config["environment"]["BUILDDIR"], ignore_errors=True) - run_tests( test_list=test_list, build_dir=config["environment"]["BUILDDIR"], @@ -598,11 +594,6 @@ def run_tests(*, test_list, build_dir, tmpdir, jobs=1, enable_coverage=False, ar # pgrep not supported pass - # Warn if there is a cache directory - cache_dir = "%s/test/cache" % build_dir - if os.path.isdir(cache_dir): - print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir)) - # Warn if there is not enough space on the testing dir min_space = MIN_FREE_SPACE + (jobs - 1) * ADDITIONAL_SPACE_PER_JOB if shutil.disk_usage(tmpdir).free < min_space: @@ -614,7 +605,8 @@ def run_tests(*, test_list, build_dir, tmpdir, jobs=1, enable_coverage=False, ar # a hard link or a copy on any platform. See https://github.com/bitcoin/bitcoin/pull/27561. sys.path.append(tests_dir) - flags = ['--cachedir={}'.format(cache_dir)] + args + cache_tmp_dir = tempfile.TemporaryDirectory(prefix="functional_test_cache") + flags = [f"--cachedir={cache_tmp_dir.name}"] + args if enable_coverage: coverage = RPCCoverage() @@ -631,7 +623,7 @@ def run_tests(*, test_list, build_dir, tmpdir, jobs=1, enable_coverage=False, ar sys.stdout.buffer.write(e.output) raise - #Run Tests + # Run Tests job_queue = TestHandler( num_tests_parallel=jobs, tests_dir=tests_dir,