Skip to content

Commit 1bf28b9

Browse files
committed
fixup! test(core.utils): assert key stability in cuLink driver-probe-failure test
1 parent f316c6a commit 1bf28b9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cuda_core/tests/test_program_cache.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -802,21 +802,23 @@ def _broken():
802802

803803
def test_make_program_cache_key_driver_probe_failure_taints_ptx_under_cuLink(monkeypatch):
804804
"""When the driver linker is active, _linker_backend_and_version
805-
invokes _driver_version internally; a failing driver probe propagates
806-
through the linker probe and must perturb the PTX key."""
805+
invokes _driver_version internally; a failing driver probe must (a)
806+
perturb the PTX key away from the success key, AND (b) be stable
807+
across repeated calls so the persistent cache stays usable in the
808+
failed environment."""
809+
from cuda.core import _linker
807810
from cuda.core.utils import _program_cache
808811

809812
def _broken():
810813
raise RuntimeError("driver probe failed")
811814

812-
# Force the cuLink driver path so _linker_backend_and_version reads driver_version.
813-
from cuda.core import _linker
814-
815815
monkeypatch.setattr(_linker, "_decide_nvjitlink_or_driver", lambda: True)
816816
k_ok = _make_key(code=".ptx", code_type="ptx")
817817
monkeypatch.setattr(_program_cache, "_driver_version", _broken)
818-
k_broken = _make_key(code=".ptx", code_type="ptx")
819-
assert k_ok != k_broken
818+
k_broken1 = _make_key(code=".ptx", code_type="ptx")
819+
k_broken2 = _make_key(code=".ptx", code_type="ptx")
820+
assert k_ok != k_broken1
821+
assert k_broken1 == k_broken2 # stable: same failure -> same key
820822

821823

822824
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)