mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Bring the confidential VM (CVM) integration tests up on the KVM SEV-SNP
backend in addition to MSHV. On KVM the IGVM is an Oak stage0 firmware
image and the guest kernel is supplied separately: stage0 reads the
kernel, cmdline and E820 over fw_cfg. The test harness selects this
model when a guest kernel is present at /igvm_files/bzImage, mirroring
how the stage0 IGVM is discovered; MSHV keeps using the monolithic IGVM
with the kernel baked in.
- test_infra: stage0 + direct-kernel + fw_cfg boot wiring (both the
command line and the HTTP/D-Bus API path) plus an on_kvm_sev_snp()
helper for tests to branch on.
- tests: the CVM tests that don't work on the KVM SEV-SNP path yet are
gated with #[cfg(not(feature = "kvm"))] inside the common_cvm module.
The MSHV build enables mshv,igvm,sev_snp (no kvm feature) while the
KVM build enables kvm,igvm,sev_snp,fw_cfg, so the cfg compiles these
tests into the MSHV binary only and drops them on KVM; both
hypervisors run the single common_cvm nextest profile. They all still
run on MSHV:
* test_pci_multiple_segments - stage0 places all 64-bit BARs in a
single global window, so a BAR allocated in a different
per-segment window is relocated cross-window and wedges boot.
* test_dmi_uuid / test_dmi_oem_strings /
test_dmi_system_and_chassis - SMBIOS is not delivered to SEV-SNP
guests on the KVM stage0 boot path, so the guest's DMI tables
read empty. VMM follow-up.
* test_vdpa_block - needs host vdpa_sim_blk setup, and vDPA DMA
into SEV-SNP-encrypted memory is unsupported (the guest hangs).
Assisted-by: Claude:Opus-4.8
Signed-off-by: Ruben Hakobyan <hruben@meta.com>
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck disable=SC2048,SC2086,SC2154,SC1094
|
|
set -x
|
|
|
|
# shellcheck source=/dev/null
|
|
source "$HOME"/.cargo/env
|
|
source "$(dirname "${BASH_SOURCE[0]}")/test-util.sh"
|
|
|
|
WORKLOADS_DIR="$HOME/workloads"
|
|
mkdir -p "$WORKLOADS_DIR"
|
|
mkdir -p "$WORKLOADS_DIR/junit"
|
|
|
|
process_common_args "$@"
|
|
|
|
if [ "$hypervisor" = "mshv" ]; then
|
|
build_features="mshv,igvm,sev_snp"
|
|
else # kvm
|
|
build_features="kvm,igvm,sev_snp,fw_cfg"
|
|
fi
|
|
test_features="--features $build_features"
|
|
|
|
JAMMY_OS_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.qcow2"
|
|
JAMMY_OS_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_IMAGE_NAME"
|
|
if [ ! -f "$JAMMY_OS_IMAGE" ]; then
|
|
echo "Missing: $JAMMY_OS_IMAGE — run: python3 scripts/fetch_workloads.py --test cvm"
|
|
exit 1
|
|
fi
|
|
|
|
JAMMY_OS_RAW_IMAGE_NAME="jammy-server-cloudimg-amd64-custom-20241017-0.raw"
|
|
JAMMY_OS_RAW_IMAGE="$WORKLOADS_DIR/$JAMMY_OS_RAW_IMAGE_NAME"
|
|
if [ ! -f "$JAMMY_OS_RAW_IMAGE" ]; then
|
|
pushd "$WORKLOADS_DIR" || exit
|
|
time qemu-img convert -p -f qcow2 -O raw $JAMMY_OS_IMAGE_NAME $JAMMY_OS_RAW_IMAGE_NAME || exit 1
|
|
popd || exit
|
|
fi
|
|
|
|
cargo build --features $build_features --all --release --target "$BUILD_TARGET"
|
|
|
|
export RUST_BACKTRACE=1
|
|
time cargo nextest run -p cloud-hypervisor $test_features --profile common_cvm --no-tests=pass --test-threads=$(($(nproc) / 4)) "$test_filter" -- ${test_binary_args[*]}
|
|
RES=$?
|
|
|
|
exit $RES
|