Commit Graph

187 Commits

Author SHA1 Message Date
Philipp Schuster
98aa9d9c12 tests: make VFIO memory hotplug more robust
After memory hotplug, it may happen that it takes a few seconds until a
VFIO device is available again (IOMMU/DMA mappings need update).

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 15:11:42 +00:00
Philipp Schuster
e6c8b5e816 tests: run more tests in parallel
They can safely run in parallel. This further speeds up the CI by ~5.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 15:11:42 +00:00
Nguyen Dinh Phi
1268539b26 main: remove api socket path when start_vmm fails
Previously the UNIX socket file was only removed on the success path
(start_vmm returned Ok(Some(path))). If start_vmm failed after the
HTTP API had bound a path-based socket, the file could be left on disk.
Parse --api-socket in parse_api_socket(), call start_vmm with the
result, then unlink the path in main after start_vmm returns for both
success and failure (fd= mode unchanged: no path to remove).

Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
2026-04-14 14:18:16 +00:00
Philipp Schuster
d54a7d27a1 tests: Reduce memory usage in integration tests
This reduces pressure on CI and enables to run more tests locally on
developer machines (with 16GB of RAM or less).

No functional changes.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
cd92f65f7b tests: Replace Windows integration sleeps with polling
Replace fixed sleeps in Windows integration tests with polling
helpers that wait for boot, snapshot readiness, and device
enumeration.

This keeps the same test intent while avoiding long fixed delays on
the fast path.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
44ac7c0ba0 tests: Poll snapshot restore readiness in Linux tests
Replace fixed sleeps in Linux snapshot and restore integration tests
with event monitor and API readiness checks.

This updates ivshmem and common_sequential snapshot paths to wait for
concrete restore and snapshot completion signals instead of sleeping
for an assumed amount of time.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
47024e73ce tests: Replace common integration sleeps with polling
Use polling helpers in common integration tests instead of fixed
sleeps where the tests already know the expected ready state.

This updates CPU and memory hotplug checks as well as a few
device- and restore-related waits in common_parallel to stop
oversleeping on the fast path while keeping the same assertions.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
2c395d4ae8 tests: Plumping to retry when event monitor output is not ready
Treat missing or still-short event monitor files as a retryable state
in integration test helpers.

This keeps polling-based restore and snapshot checks from failing early
with file-not-found or short-file assertions while the monitor output
is still being written.

In the following, we can gracefully wait for the corresponding
conditions to become true.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Philipp Schuster
a3b4687caa test_infra: split SSH command helpers by retry behavior
Split the SSH helpers into a one-shot execution path and a retrying
wrapper with linear backoff.

This makes it possible to use a single bounded SSH attempt when tests
need a direct readiness probe while preserving the existing retrying
behavior for callers that expect it.

On-behalf-of: SAP philipp.schuster@sap.com

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-04-14 09:18:47 +00:00
Max Makarov
c99ed77d1a tests: pci: verify per-segment ACPI _UID in DSDT
Extend test_pci_multiple_segments_numa_node to assert that every
PNP0A08 host bridge in the guest DSDT exposes a unique _UID
matching its PCI segment id. Linux surfaces the evaluated _UID
value through /sys/bus/acpi/devices/PNP0A08:*/uid, so the check
is a single additional ssh command on top of the existing test
plumbing.

This test is used (rather than test_pci_multiple_segments) so
that the assertion runs on both x86_64 and aarch64: the numa_node
variant boots through edk2 firmware on aarch64, making ACPI (and
PNP0A08 host bridges) available, whereas the non-firmware variant
uses FDT on aarch64 and exposes no PNP0A08 nodes.

Without a per-segment _UID, two PNP0A08 nodes share _UID=0 which
violates ACPI 6.5 section 6.1.12 and triggers BSOD 0xA5 on
Windows guests. This assertion would catch any future regression
of that kind.

Signed-off-by: Max Makarov <maxpain@linux.com>
2026-04-13 09:39:55 +00:00
Bo Chen
6adc4f2c90 tests: vfio: Add more checks on the Nvidia GPU from the guest
Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-13 07:40:02 +00:00
Bo Chen
9d47769bc2 tests: Add iommufd integration tests
Add an `iommufd` flag to existing VFIO integration tests. When false,
tests use the legacy vfio container/group backend (existing behavior).
When true, tests use vfio cdev with iommufd and vfio_p2p_dma=off.

vfio_p2p_dma=off is required because the VFIO test runner uses a stock
Ubuntu 24.04 kernel (v6.8) which does not support mapping device MMIO
pages (VM_PFNMAP) through iommufd, causing IOMMU_IOAS_MAP to fail with
-EFAULT on MMIO BAR regions.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Bo Chen
7f377eadd9 vmm: Fix --platform syntax with optional feature flags
The `--platform` help string was hardcoded and did not reflect which
optional features (tdx, sev_snp) were actually enabled in. Build the
syntax string dynamically as `PlatformConfig::syntax()`, conditionally
appending feature-gated options so the CLI help stays accurate.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
2026-04-10 22:55:38 +00:00
Sebastian Eydam
17919a7a8c tests: add integration test for migration with multiple TCP connections
On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Sebastian Eydam
a9a832f392 vmm: validate VmSendMigrationData
Validates that there are no conflicting options set, and that the
destination URL is valid.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
2026-04-02 23:43:42 +00:00
Muminul Islam
c8bfac66f4 test_infra: Move remote_command to test_infra
Move remote_command() and remote_command_w_output() from
tests/common/utils.rs into test_infra/src/lib.rs to allow
reuse across crates.

The cloud-hypervisor integration tests already use
'use test_infra::*', so the functions are available
without any caller changes.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Anatol Belski
9db5f0439e tests: Stabilize block rate limiter workloads
Add a ramp time before measuring the block rate limiter tests so
both the single device and group workloads are measured after
warm up to make the measurements less sensitive to startup
transients.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-01 13:36:58 +00:00
Anatol Belski
36d6dacee2 tests: Increase group block rate limiter refill window
Increase the group block refill time from 100 ms to 1000 ms and
scale the shared bucket sizes to preserve the target rate.

Set the one time burst to 0 to avoid transient overshoot and use
the shared block runtime constant directly in the group path.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-01 13:36:58 +00:00
Anatol Belski
f116038111 tests: Increase rate limiter refill time
The rate limiter token bucket has a fixed 100 ms cool down time
that pauses I/O whenever the bucket empties. With a 100 ms refill
time, the actual throughput drops to roughly half of the target
rate and causes the tests to miss their target.

Increase the net and single block refill time from 100 ms to
1000 ms and scale the bucket sizes by 10x to preserve the target
rate. Set the one time burst to 0 to avoid overshooting the upper
bound, and raise the runtime constants from 10 s to 20 s for
steadier measurements.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-01 13:36:58 +00:00
Anatol Belski
6de3d5279f tests: Constify rate limiter runtimes
Introduce named constants for the net and single block rate limiter
test runtimes and use them directly at the call sites.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-01 13:36:58 +00:00
Rob Bradford
a99c40dbbb tests: Add live migration test for virtio-fs
Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-04-01 11:35:38 +00:00
CMGS
e4e2a37afa block: Restrict DISCARD to explicit sparse=true
PR #7852 fixed the missing VirtioBlockConfig fields but did not
change the feature advertisement logic. The condition
`sparse || disk_image.supports_zero_flag()` causes qcow2 to
advertise DISCARD even with sparse=false, because qcow2 can
mark clusters as zero (supports_zero_flag() returns true).

Windows viostor BSODs (DRIVER_IRQL_NOT_LESS_OR_EQUAL) when
DISCARD is advertised on qcow2 backends, making sparse=off
ineffective as a workaround for qcow2 images.

Restrict DISCARD to explicit sparse=true only. WRITE_ZEROES
remains available for all sparse-capable backends.

Fixes #7849

Signed-off-by: CMGS <ilskdw@gmail.com>
2026-03-31 18:57:52 +00:00
Philipp Schuster
c06f6c3293 tests: fix CI flakiness
This test has failed at least once in upstream CI. With the applied
stress workload, reducing the downtime to 1 ms makes it virtually
impossible for CI runners with various speeds to complete VM migration.

In other words: we will always be able to cancel.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-03-27 16:29:28 +00:00
Rob Bradford
0bc3ca1103 tests: Add snapshot/restore integration test for virtio-fs
Add test_snapshot_restore_virtio_fs which validates that virtio-fs
continues to work correctly across a snapshot/restore cycle.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-27 14:18:27 +00:00
Muminul Islam
80ce696006 tests: add CVM test for vdpa_block
Add a CVM integration test for vdpa_block that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro and with_cpu(2).

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
7e62565cca tests: add CVM test for macvtap_hotplug
Add a CVM integration test for macvtap_hotplug that validates
the same functionality using a confidential guest with the
basic_cvm_guest macro and with_cpu(2).

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
b7bd19b24a tests: add CVM test for macvtap
Add a CVM integration test for macvtap that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro and with_cpu(2).

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
6fa6ead2b3 tests: add CVM test for tap_from_fd
Add a CVM integration test for tap_from_fd that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro and with_cpu(2).

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
7d672872d6 tests: add CVM test for pvpanic
Add a CVM integration test for pvpanic that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
5ad9822a50 tests: add CVM test for watchdog
Add a CVM integration test for watchdog that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro and FOCAL_IMAGE_NAME.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
81f26bd995 tests: add CVM test for counters
Add a CVM integration test for counters that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
9a88b9a42e tests: add CVM test for net_hotplug
Add a CVM integration test for net_hotplug that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
60abdf0ea1 tests: add CVM test for disk_hotplug
Add a CVM integration test for disk_hotplug that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
9564b4f278 tests: add CVM test for landlock
Add a CVM integration test for landlock that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
833d1d39a5 tests: add CVM test for memory_overhead
Add a CVM integration test for memory_overhead that validates
the same functionality using a confidential guest with the
basic_cvm_guest macro and custom memory size.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
0c477c12ec tests: add CVM test for pci_bar_reprogramming
Add a CVM integration test for pci_bar_reprogramming that
validates the same functionality using a confidential guest
with the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
f4df95c142 tests: add CVM test for direct_kernel_boot_noacpi
Add a CVM integration test for direct_kernel_boot_noacpi
that validates the same functionality using a confidential
guest with the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
a4f1c65b14 tests: add CVM test for console_file
Add a CVM integration test for console_file that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
e9d8ecf38a tests: add CVM test for virtio_console
Add a CVM integration test for virtio_console that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
36871b3547 tests: add CVM test for serial_off
Add a CVM integration test for serial_off that validates
the same functionality using a confidential guest with
the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
108391f720 tests: add CVM test for multiple_network_interfaces
Add a CVM integration test for multiple_network_interfaces
that validates the same functionality using a confidential
guest with the basic_cvm_guest macro.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
e89b584694 tests: extract _test_vdpa_block to tests_wrappers
Extract test logic from test_vdpa_block into a shared
_test_vdpa_block wrapper function in tests_wrappers.rs.
The vdpa module check is kept in the parent test case.
Update the parent to use basic_regular_guest macro with
with_cpu(2). The wrapper uses default_kernel_cmdline()
for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
205bb5ff5e tests: extract _test_macvtap to tests_wrappers
Extract test logic from _test_macvtap into a shared wrapper
function in tests_wrappers.rs. Update both test_macvtap and
test_macvtap_hotplug to use the basic_regular_guest macro
with with_cpu(2). The wrapper uses default_kernel_cmdline()
for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
a3423a4483 tests: extract _test_tap_from_fd to tests_wrappers
Extract test logic from test_tap_from_fd into a shared
_test_tap_from_fd wrapper function in tests_wrappers.rs.
Update the parent test case to use the basic_regular_guest
macro with with_cpu(2). The wrapper uses
default_kernel_cmdline() for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
17774ee564 tests: extract _test_pvpanic to tests_wrappers
Extract test logic from test_pvpanic into a shared
_test_pvpanic wrapper function in tests_wrappers.rs.
Update the parent test case to use the basic_regular_guest
macro. The wrapper uses default_kernel_cmdline() for
kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
93a3fc5b91 tests: extract _test_watchdog to tests_wrappers
Extract test logic from test_watchdog into a shared
_test_watchdog wrapper function in tests_wrappers.rs.
Update the parent test case to use the basic_regular_guest
macro with FOCAL_IMAGE_NAME. The wrapper uses
default_kernel_cmdline() for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
4b77ac26d1 tests: extract _test_counters to tests_wrappers
Extract test logic from test_counters into a shared
_test_counters wrapper function in tests_wrappers.rs.
Update the parent test case to use the basic_regular_guest
macro. The wrapper uses default_kernel_cmdline() for
kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
7284c02d31 tests: extract _test_net_hotplug to tests_wrappers
Extract test logic from _test_net_hotplug into a shared
wrapper function in tests_wrappers.rs. Update both
test_net_hotplug and test_net_multi_segment_hotplug to
use the basic_regular_guest macro. The wrapper uses
default_kernel_cmdline() for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
ef81bb1358 tests: extract _test_virtio_block_topology wrapper
Extract test logic from test_virtio_block_topology into
a shared _test_virtio_block_topology wrapper function in
tests_wrappers.rs. The loop device creation and cleanup
are kept in the parent test case. The wrapper uses
default_kernel_cmdline() for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00
Muminul Islam
8f40aed0ca tests: extract _test_disk_hotplug to tests_wrappers
Extract test logic from _test_disk_hotplug into a shared
wrapper function in tests_wrappers.rs. Update both
test_disk_hotplug and test_disk_hotplug_with_landlock
to use the basic_regular_guest macro. The wrapper uses
default_kernel_cmdline() for kernel/cmdline setup.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-25 13:34:59 +00:00