Skip to content

Commit a7bc4fc

Browse files
committed
test(e2e): fall back to /usr/sbin/nvidia-smi on Tegra
On Jetson/Tegra platforms nvidia-smi is installed at /usr/sbin/nvidia-smi rather than /usr/bin/nvidia-smi and may not be on PATH inside the sandbox. Fall back to the full path when the bare command is not found. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 492225b commit a7bc4fc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

e2e/python/test_sandbox_gpu.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ def test_gpu_sandbox_reports_available_gpu(
2020
sandbox: Callable[..., Sandbox],
2121
gpu_sandbox_spec: datamodel_pb2.SandboxSpec,
2222
) -> None:
23+
nvidia_smi_args = ["--query-gpu=name", "--format=csv,noheader"]
2324
with sandbox(spec=gpu_sandbox_spec, delete_on_exit=True) as sb:
24-
result = sb.exec(
25-
["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"],
26-
timeout_seconds=30,
27-
)
25+
result = sb.exec(["nvidia-smi", *nvidia_smi_args], timeout_seconds=30)
26+
if result.exit_code != 0:
27+
# On some platforms (e.g. Tegra/Jetson) nvidia-smi lives in
28+
# /usr/sbin rather than /usr/bin and may not be on PATH.
29+
result = sb.exec(["/usr/sbin/nvidia-smi", *nvidia_smi_args], timeout_seconds=30)
2830

2931
assert result.exit_code == 0, result.stderr
3032
assert result.stdout.strip()

0 commit comments

Comments
 (0)