Skip to content

Commit 9bf7ca6

Browse files
committed
qa: Consider cache and config.ini relative to invocation directory
In CMake-based build system (1) `config.ini` is created in the build directory, and (2) `cache` must also be created in the same directory. This change enables running individual functional tests from the build directory.
1 parent a047344 commit 9bf7ca6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, test_file) -> None:
103103
self.rpc_timeout = 60 # Wait for up to 60 seconds for the RPC server to respond
104104
self.supports_cli = True
105105
self.bind_to_localhost_only = True
106-
self.parse_args()
106+
self.parse_args(test_file)
107107
self.default_wallet_name = "default_wallet" if self.options.descriptors else ""
108108
self.wallet_data_filename = "wallet.dat"
109109
# Optional list of wallet names that can be set in set_test_params to
@@ -155,14 +155,14 @@ def main(self):
155155
exit_code = self.shutdown()
156156
sys.exit(exit_code)
157157

158-
def parse_args(self):
158+
def parse_args(self, test_file):
159159
previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
160160
parser = argparse.ArgumentParser(usage="%(prog)s [options]")
161161
parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true",
162162
help="Leave bitcoinds and test.* datadir on exit or error")
163163
parser.add_argument("--noshutdown", dest="noshutdown", default=False, action="store_true",
164164
help="Don't stop bitcoinds after the test execution")
165-
parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"),
165+
parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(test_file) + "/../cache"),
166166
help="Directory for caching pregenerated datadirs (default: %(default)s)")
167167
parser.add_argument("--tmpdir", dest="tmpdir", help="Root directory for datadirs (must not exist)")
168168
parser.add_argument("-l", "--loglevel", dest="loglevel", default="INFO",
@@ -177,7 +177,7 @@ def parse_args(self):
177177
parser.add_argument("--coveragedir", dest="coveragedir",
178178
help="Write tested RPC commands into this directory")
179179
parser.add_argument("--configfile", dest="configfile",
180-
default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"),
180+
default=os.path.abspath(os.path.dirname(test_file) + "/../config.ini"),
181181
help="Location of the test framework config file (default: %(default)s)")
182182
parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
183183
help="Attach a python debugger if test fails")

0 commit comments

Comments
 (0)