tests: vfio: Capture guest dmesg when nvidia-smi failed

The guest dmesg can provide more context from the guest kernel, say
Nvidia driver errors, IOMMU faults, etc.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen
2026-04-11 04:51:22 +00:00
committed by Rob Bradford
parent 6adc4f2c90
commit e8b6fe0548

View File

@@ -1316,11 +1316,18 @@ impl Guest {
#[cfg(target_arch = "x86_64")]
pub fn check_nvidia_gpu(&self) {
assert!(
self.ssh_command("nvidia-smi")
.unwrap()
.contains("NVIDIA L40S")
);
let output = self.ssh_command("nvidia-smi").unwrap();
if !output.contains("NVIDIA L40S") {
let dmesg = self
.ssh_command("sudo dmesg")
.unwrap_or_else(|e| format!("Failed to get dmesg: {e:?}"));
eprintln!(
"\n\n==== Guest dmesg (nvidia-smi check failed) ====\n\n\
{dmesg}\n\
\n==== End guest dmesg ====\n\n"
);
panic!("nvidia-smi output did not contain 'NVIDIA L40S': {output}");
}
}
pub fn reboot_linux(&self, current_reboot_count: u32) {