From e23f4e0783eb10d99ff3b3063a1f7a1de20e61d1 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 24 Nov 2022 17:27:20 +0100 Subject: [PATCH] tests: Enable VFIO integration tests Re-enable the VFIO integration now the machine is back online. The image has been updated to rely on Ubuntu 22.04 (Jammy) and it's smaller given only the NVIDIA drivers along with the nvidia-smi tool are installed. The test to verify the GPU is functional has been simplified given it only relies on nvidia-smi to validate it has been able to find the Tesla T4 card, meaning the associated driver was loaded correctly. Signed-off-by: Sebastien Boeuf --- Jenkinsfile | 41 +++++++++++++++++++++++++++ scripts/run_integration_tests_vfio.sh | 4 +++ test_infra/src/lib.rs | 22 +------------- tests/integration.rs | 14 ++++----- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 927fbb3a5..8a45cb7dc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -347,6 +347,47 @@ pipeline { } } } + stage('Worker build - VFIO') { + agent { node { label 'jammy-vfio' } } + when { + beforeAgent true + allOf { + branch 'main' + expression { + return runWorkers + } + } + } + stages { + stage('Checkout') { + steps { + checkout scm + } + } + stage('Run VFIO integration tests') { + options { + timeout(time: 1, unit: 'HOURS') + } + steps { + sh 'scripts/dev_cli.sh tests --integration-vfio' + } + } + stage('Run VFIO integration tests for musl') { + options { + timeout(time: 1, unit: 'HOURS') + } + steps { + sh 'scripts/dev_cli.sh tests --integration-vfio --libc musl' + } + } + } + post { + always { + sh "sudo chown -R jenkins.jenkins ${WORKSPACE}" + deleteDir() + } + } + } } } } diff --git a/scripts/run_integration_tests_vfio.sh b/scripts/run_integration_tests_vfio.sh index b02bd6e78..e5dfe40b1 100755 --- a/scripts/run_integration_tests_vfio.sh +++ b/scripts/run_integration_tests_vfio.sh @@ -10,7 +10,11 @@ WORKLOADS_DIR="$HOME/workloads" FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210609-0.raw" FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME" FW="$WORKLOADS_DIR/hypervisor-fw" + VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux" +if [ ! -f "$VMLINUX_IMAGE" ]; then + build_custom_linux +fi BLK_IMAGE="$WORKLOADS_DIR/blk.img" MNT_DIR="mount_image" diff --git a/test_infra/src/lib.rs b/test_infra/src/lib.rs index d91dfa611..4e896a508 100644 --- a/test_infra/src/lib.rs +++ b/test_infra/src/lib.rs @@ -1063,27 +1063,7 @@ impl Guest { #[cfg(target_arch = "x86_64")] pub fn check_nvidia_gpu(&self) { - // Run CUDA sample to validate it can find the device - let device_query_result = self - .ssh_command("sudo /root/NVIDIA_CUDA-11.3_Samples/bin/x86_64/linux/release/deviceQuery") - .unwrap(); - assert!(device_query_result.contains("Detected 1 CUDA Capable device")); - assert!(device_query_result.contains("Device 0: \"NVIDIA Tesla T4\"")); - assert!(device_query_result.contains("Result = PASS")); - - // Run NVIDIA DCGM Diagnostics to validate the device is functional - self.ssh_command("sudo nv-hostengine").unwrap(); - - assert!(self - .ssh_command("sudo dcgmi discovery -l") - .unwrap() - .contains("Name: NVIDIA Tesla T4")); - assert_eq!( - self.ssh_command("sudo dcgmi diag -r 'diagnostic' | grep Pass | wc -l") - .unwrap() - .trim(), - "10" - ); + assert!(self.ssh_command("nvidia-smi").unwrap().contains("Tesla T4")); } pub fn reboot_linux(&self, current_reboot_count: u32, custom_timeout: Option) { diff --git a/tests/integration.rs b/tests/integration.rs index fe73a4a1e..148d6b2b6 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -35,7 +35,7 @@ mod x86_64 { pub const BIONIC_IMAGE_NAME: &str = "bionic-server-cloudimg-amd64.raw"; pub const FOCAL_IMAGE_NAME: &str = "focal-server-cloudimg-amd64-custom-20210609-0.raw"; pub const FOCAL_SGX_IMAGE_NAME: &str = "focal-server-cloudimg-amd64-sgx.raw"; - pub const HIRSUTE_NVIDIA_IMAGE_NAME: &str = "hirsute-server-cloudimg-amd64-nvidia.raw"; + pub const JAMMY_NVIDIA_IMAGE_NAME: &str = "jammy-server-cloudimg-amd64-nvidia.raw"; pub const FOCAL_IMAGE_NAME_QCOW2: &str = "focal-server-cloudimg-amd64-custom-20210609-0.qcow2"; pub const FOCAL_IMAGE_NAME_VHD: &str = "focal-server-cloudimg-amd64-custom-20210609-0.vhd"; pub const FOCAL_IMAGE_NAME_VHDX: &str = "focal-server-cloudimg-amd64-custom-20210609-0.vhdx"; @@ -8075,8 +8075,8 @@ mod vfio { } fn test_nvidia_card_memory_hotplug(hotplug_method: &str) { - let hirsute = UbuntuDiskConfig::new(HIRSUTE_NVIDIA_IMAGE_NAME.to_string()); - let guest = Guest::new(Box::new(hirsute)); + let jammy = UbuntuDiskConfig::new(JAMMY_NVIDIA_IMAGE_NAME.to_string()); + let guest = Guest::new(Box::new(jammy)); let api_socket = temp_api_path(&guest.tmp_dir); let mut child = GuestCommand::new(&guest) @@ -8129,8 +8129,8 @@ mod vfio { #[test] fn test_nvidia_card_pci_hotplug() { - let hirsute = UbuntuDiskConfig::new(HIRSUTE_NVIDIA_IMAGE_NAME.to_string()); - let guest = Guest::new(Box::new(hirsute)); + let jammy = UbuntuDiskConfig::new(JAMMY_NVIDIA_IMAGE_NAME.to_string()); + let guest = Guest::new(Box::new(jammy)); let api_socket = temp_api_path(&guest.tmp_dir); let mut child = GuestCommand::new(&guest) @@ -8171,8 +8171,8 @@ mod vfio { #[test] fn test_nvidia_card_reboot() { - let hirsute = UbuntuDiskConfig::new(HIRSUTE_NVIDIA_IMAGE_NAME.to_string()); - let guest = Guest::new(Box::new(hirsute)); + let jammy = UbuntuDiskConfig::new(JAMMY_NVIDIA_IMAGE_NAME.to_string()); + let guest = Guest::new(Box::new(jammy)); let api_socket = temp_api_path(&guest.tmp_dir); let mut child = GuestCommand::new(&guest)