Skip to content

Commit 6429bd9

Browse files
author
Sebastien Boeuf
committed
ch_integration_tests: Add OVMF firmware booting test
Add a new integration test to validate that libvirt can boot a Cloud Hypervisor VM using the OVMF firmware. Signed-off-by: Sebastien Boeuf <[email protected]>
1 parent f662f28 commit 6429bd9

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

Jenkinsfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ pipeline{
2929
checkout scm
3030
}
3131
}
32+
stage ('Download assets') {
33+
steps {
34+
sh "mkdir -p ${env.HOME}/workloads"
35+
azureDownload(storageCredentialId: 'ch-image-store',
36+
containerName: 'private-images',
37+
includeFilesPattern: 'OVMF-4b47d0c6c8.fd',
38+
downloadType: 'container',
39+
downloadDirLoc: "${env.HOME}/workloads")
40+
}
41+
}
3242
stage ('Install dependencies') {
3343
steps {
3444
sh "sudo apt update && sudo apt install -y meson ninja-build gcc libxml2-utils xsltproc python3-docutils libglib2.0-dev libgnutls28-dev libxml2-dev libnl-3-dev libnl-route-3-dev libyajl-dev make libcurl4-gnutls-dev qemu-utils libssl-dev mtools libudev-dev libpciaccess-dev flex bison libelf-dev"

ch_integration_tests/run_tests.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ if [ ! -f "$FW" ]; then
1313
popd
1414
fi
1515

16+
OVMF_FW="$WORKLOADS_DIR/OVMF-4b47d0c6c8.fd"
17+
# Check OVMF firmware is present
18+
if [[ ! -f ${OVMF_FW} ]]; then
19+
echo "OVMF firmware not present on the host"
20+
exit 1
21+
fi
22+
1623
FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64-custom-20210407-0.qcow2"
1724
FOCAL_OS_IMAGE_URL="https://cloudhypervisorstorage.blob.core.windows.net/images/$FOCAL_OS_IMAGE_NAME"
1825
FOCAL_OS_IMAGE="$WORKLOADS_DIR/$FOCAL_OS_IMAGE_NAME"

ch_integration_tests/tests/integration.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,31 @@ mod tests {
5757
#[derive(PartialEq)]
5858
enum KernelType {
5959
Direct,
60+
OvmfFw,
6061
RustFw,
6162
}
6263

6364
impl KernelType {
6465
fn path(&self) -> PathBuf {
66+
#[cfg(target_arch = "aarch64")]
67+
assert!(self == KernelType::Direct);
68+
6569
let mut kernel_path = dirs::home_dir().unwrap();
6670
kernel_path.push("workloads");
6771

6872
match self {
69-
KernelType::RustFw => {
70-
#[cfg(target_arch = "aarch64")]
71-
kernel_path.push("Image");
72-
#[cfg(target_arch = "x86_64")]
73-
kernel_path.push("hypervisor-fw");
74-
}
7573
KernelType::Direct => {
7674
#[cfg(target_arch = "aarch64")]
7775
kernel_path.push("Image");
7876
#[cfg(target_arch = "x86_64")]
7977
kernel_path.push("vmlinux");
8078
}
79+
KernelType::OvmfFw => {
80+
kernel_path.push("OVMF-4b47d0c6c8.fd");
81+
}
82+
KernelType::RustFw => {
83+
kernel_path.push("hypervisor-fw");
84+
}
8185
}
8286

8387
kernel_path
@@ -574,6 +578,11 @@ mod tests {
574578
assert!(r.is_ok());
575579
}
576580

581+
#[test]
582+
fn test_ovmf_fw_boot() {
583+
test_create_vm(KernelType::OvmfFw)
584+
}
585+
577586
#[test]
578587
fn test_rust_fw_boot() {
579588
test_create_vm(KernelType::RustFw)

0 commit comments

Comments
 (0)