Skip to content

Commit 42bebe3

Browse files
committed
pathfinder: skip nvcudla tests when runtime is absent
Skip the cudla and nvcudla load tests on aarch64 hosts when the nvcudla canary probe cannot resolve libnvcudla.so. This keeps non-Tegra linux-aarch64 systems from failing strict test runs while still exercising the real success path on Tegra platforms where the platform runtime is installed. Made-with: Cursor
1 parent 2481bd1 commit 42bebe3

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

cuda_pathfinder/tests/test_driver_lib_loading.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
run_load_nvidia_dynamic_lib_in_subprocess,
1717
)
1818

19+
from cuda.pathfinder._dynamic_libs import load_nvidia_dynamic_lib as load_nvidia_dynamic_lib_module
1920
from cuda.pathfinder._dynamic_libs.lib_descriptor import LIB_DESCRIPTORS
2021
from cuda.pathfinder._dynamic_libs.load_dl_common import DynamicLibNotFoundError, LoadedDL
2122
from cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_lib import (
@@ -24,7 +25,7 @@
2425
_load_lib_no_cache,
2526
)
2627
from cuda.pathfinder._dynamic_libs.subprocess_protocol import STATUS_NOT_FOUND, parse_dynamic_lib_subprocess_payload
27-
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS, quote_for_shell
28+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS, PLATFORM_MACHINE, quote_for_shell
2829

2930
STRICTNESS = os.environ.get("CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS", "see_what_works")
3031
assert STRICTNESS in ("see_what_works", "all_must_work")
@@ -40,6 +41,14 @@ def _make_loaded_dl(path, found_via):
4041
return LoadedDL(path, False, 0xDEAD, found_via)
4142

4243

44+
def _skip_if_missing_nvcudla_runtime(libname: str, *, timeout: float) -> None:
45+
if libname != "nvcudla" or PLATFORM_MACHINE != "aarch64":
46+
return
47+
if load_nvidia_dynamic_lib_module._loadable_via_canary_subprocess("nvcudla", timeout=timeout):
48+
return
49+
pytest.skip("libnvcudla.so is not loadable via canary subprocess on this host.")
50+
51+
4352
# ---------------------------------------------------------------------------
4453
# _load_driver_lib_no_cache
4554
# ---------------------------------------------------------------------------
@@ -147,6 +156,7 @@ def raise_child_process_failed():
147156
error_label="Load subprocess child process",
148157
)
149158
if payload.status == STATUS_NOT_FOUND:
159+
_skip_if_missing_nvcudla_runtime(libname, timeout=timeout)
150160
if STRICTNESS == "all_must_work":
151161
raise_child_process_failed()
152162
info_summary_append(f"Not found: {libname=!r}")

cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
STATUS_NOT_FOUND,
1919
parse_dynamic_lib_subprocess_payload,
2020
)
21-
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS, quote_for_shell
21+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS, PLATFORM_MACHINE, quote_for_shell
2222

2323
STRICTNESS = os.environ.get("CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS", "see_what_works")
2424
assert STRICTNESS in ("see_what_works", "all_must_work")
@@ -106,6 +106,14 @@ def _is_expected_load_nvidia_dynamic_lib_failure(libname):
106106
return False
107107

108108

109+
def _skip_if_missing_nvcudla_runtime(libname: str, *, timeout: float) -> None:
110+
if libname != "nvcudla" or PLATFORM_MACHINE != "aarch64":
111+
return
112+
if load_nvidia_dynamic_lib_module._loadable_via_canary_subprocess("nvcudla", timeout=timeout):
113+
return
114+
pytest.skip("libnvcudla.so is not loadable via canary subprocess on this host.")
115+
116+
109117
@pytest.mark.parametrize(
110118
"libname",
111119
supported_nvidia_libs.SUPPORTED_WINDOWS_DLLS if IS_WINDOWS else supported_nvidia_libs.SUPPORTED_LINUX_SONAMES,
@@ -132,6 +140,7 @@ def raise_child_process_failed():
132140
error_label="Load subprocess child process",
133141
)
134142
if payload.status == STATUS_NOT_FOUND:
143+
_skip_if_missing_nvcudla_runtime(libname, timeout=timeout)
135144
if STRICTNESS == "all_must_work" and not _is_expected_load_nvidia_dynamic_lib_failure(libname):
136145
raise_child_process_failed()
137146
info_summary_append(f"Not found: {libname=!r}")

0 commit comments

Comments
 (0)