Skip to content

Commit 5b65268

Browse files
committed
Fix CI failures on PR #1980
- Docs: invalid RST ``RPATH``s (inline literal must be followed by a non-word character) caused -W to fail the Sphinx build. Reword to ``RPATH`` entries. - Tests: test_find_nvidia_dynamic_lib_does_not_load_in_caller_process spawned python -c without setting cwd. Pytest's cwd (the source tree) ended up on sys.path[0], so the child resolved the source-tree cuda.pathfinder which lacks the install-generated _version.py. Use DYNAMIC_LIB_SUBPROCESS_CWD as the production subprocess helper does; that path resolves to the installed package root.
1 parent bbd41d4 commit 5b65268

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def find_nvidia_dynamic_lib(libname: str) -> str:
5656
Notes:
5757
Because resolution happens in a separate process, results may differ
5858
from an in-process ``load_nvidia_dynamic_lib`` if the caller's process
59-
has DSOs loaded with custom ``RPATH``s or has already loaded a matching
59+
has DSOs loaded with custom ``RPATH`` entries or has already loaded a matching
6060
library by some other mechanism. The intent is to report the path the
6161
loader would pick when not influenced by other DSOs in the caller.
6262
"""

cuda_pathfinder/tests/test_find_nvidia_dynamic_lib.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from cuda.pathfinder._dynamic_libs import load_nvidia_dynamic_lib as load_nvidia_dynamic_lib_module
2121
from cuda.pathfinder._dynamic_libs import supported_nvidia_libs
2222
from cuda.pathfinder._dynamic_libs.subprocess_protocol import (
23+
DYNAMIC_LIB_SUBPROCESS_CWD,
2324
STATUS_NOT_FOUND,
2425
STATUS_OK,
2526
DynamicLibSubprocessPayload,
@@ -135,12 +136,16 @@ def test_find_nvidia_dynamic_lib_does_not_load_in_caller_process():
135136
# Run in a fresh interpreter so other pathfinder tests in the same
136137
# pytest process can't have pre-loaded the library.
137138
libname = "cudart"
139+
# Match the cwd used by the production subprocess helper so the child
140+
# resolves the installed ``cuda.pathfinder`` (with ``_version.py``) rather
141+
# than a source tree shadow on ``sys.path[0]``.
138142
result = subprocess.run( # noqa: S603 - trusted argv: current interpreter + inline probe
139143
[sys.executable, "-c", _DOES_NOT_LOAD_PROBE, libname],
140144
capture_output=True,
141145
text=True,
142146
timeout=60,
143147
check=False,
148+
cwd=DYNAMIC_LIB_SUBPROCESS_CWD,
144149
)
145150
assert result.returncode == 0, f"probe failed:\nstdout={result.stdout!r}\nstderr={result.stderr!r}"
146151
verdict = result.stdout.strip().splitlines()[-1]

0 commit comments

Comments
 (0)