Skip to content

Commit 106ab9b

Browse files
committed
test(cuda.core): cover NVRTC debug fallback when temp is unwritable
1 parent f260dd7 commit 106ab9b

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎cuda_core/tests/test_program.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,25 @@ def test_nvrtc_debug_materializes_source_to_temp_file(init_cuda, tmp_path):
10241024
assert not os.path.isfile(implicit_name)
10251025

10261026

1027+
@pytest.mark.agent_authored(model="cursor-grok-4.6")
1028+
@pytest.mark.thread_unsafe(reason="monkeypatches tempfile.mkstemp on the Program module")
1029+
def test_nvrtc_debug_falls_back_when_tmp_not_writable(init_cuda, monkeypatch):
1030+
"""debug=True still compiles if the temp dir cannot be written (issue #2422)."""
1031+
from cuda.core import _program
1032+
1033+
def _denied(*_args, **_kwargs):
1034+
raise OSError(30, "Read-only file system")
1035+
1036+
monkeypatch.setattr(_program.tempfile, "mkstemp", _denied)
1037+
1038+
code = 'extern "C" __global__ void matmul() {}'
1039+
prog = Program(code, "c++", ProgramOptions(debug=True, arch="sm_80"))
1040+
try:
1041+
assert prog.compile("ptx").name == "default_program"
1042+
finally:
1043+
prog.close()
1044+
1045+
10271046
@pytest.mark.agent_authored(model="cursor-grok-4.6")
10281047
def test_cuda_gdb_shows_nvrtc_debug_source_lines(init_cuda):
10291048
import pathlib

0 commit comments

Comments
 (0)