test: Add missing resolve() to valgrind.supp file

Normally, when a symlinked test script is executed directly (e.g.,
`./bld-cmake/test/functional/wallet_disable.py`), Python's default
behavior is to resolve the symlink of the script itself, setting
`sys.path[0]` to the directory containing the physical source file.
Consequently, the test framework util.py is imported from the source
tree, and `Path(__file__).parents[3]` correctly resolves to the source
root.

However, `feature_framework_testshell.py` is unique because it manually
inserts `Path(__file__).parent` into `sys.path`. That refers to the
build tree and when importing the test framework util.py, the
`Path(__file__).parents[3]` will incorrectly point to the build
directory instead of the source root.

Use `.resolve()` to ensure the Valgrind suppressions file path is always
calculated relative to the physical source file, regardless of how the
framework was imported.
This commit is contained in:
MarcoFalke
2026-02-25 14:36:10 +01:00
parent 05cd3b00b9
commit fa9cf81d39

View File

@@ -251,7 +251,7 @@ class Binaries:
def __init__(self, paths, bin_dir, *, use_valgrind=False):
self.paths = paths
self.bin_dir = bin_dir
suppressions_file = pathlib.Path(__file__).parents[3] / "contrib" / "valgrind.supp"
suppressions_file = pathlib.Path(__file__).resolve().parents[3] / "contrib" / "valgrind.supp"
self.valgrind_cmd = [
"valgrind",
f"--suppressions={suppressions_file}",