The cmake build system creates a build/
directory and writes config.ini
there, along with a tree of symlinks to test_framework
and all the individual test files. This symlink breaks the fix in #30714 which resolved those symlinks, causing the TestShell
to initialize in the original test directory, where config.ini
does not exist.
The fix in this patch is simply not to resolve the symlinks, so TestShell
uses:
/path/to/bitcoin/build/test/config.ini
/path/to/bitcoin/build/test/cache
Note that any arguments like configfile
and cachedir
that are passed to setup()
will be too late to work around the issue since the constructor TestShell()
is invoked with a file path first and that path determines config file and cache location.
Test script:
0#!/usr/bin/env python3
1
2# USAGE: shell.py /path/to/bitcoin/repo
3
4from pathlib import Path
5import sys
6REPO = Path(sys.argv.pop())
7sys.path.insert(0, f"{REPO / 'build' / 'test' / 'functional'}")
8from test_framework.test_shell import TestShell
9
10TestShell().setup(num_nodes=1, setup_clean_chain=True)
11TestShell().shutdown()
Fails on master:
0FileNotFoundError: [Errno 2] No such file or directory: '/Users/matthewzipkin/Desktop/work/bitcoin/test/config.ini'