From 7bf439975f0a23cf23b51245fc18cd560c55adf8 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Thu, 5 Mar 2026 19:45:48 -0800 Subject: [PATCH] tests: Add CPU affinity test for confidential VMs Add test_cpu_affinity to the common_cvm integration test module to verify that CPU pinning works correctly in confidential guest environments. The test creates a 2-vCPU Ubuntu Jammy-based confidential VM using GuestFactory and delegates to the existing _test_cpu_affinity helper to validate vCPU-to-core affinity. Signed-off-by: Muminul Islam --- cloud-hypervisor/tests/integration.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cloud-hypervisor/tests/integration.rs b/cloud-hypervisor/tests/integration.rs index 50d9f4e4c..dbb29b675 100644 --- a/cloud-hypervisor/tests/integration.rs +++ b/cloud-hypervisor/tests/integration.rs @@ -14957,4 +14957,13 @@ mod common_cvm { GuestFactory::new_confidential_guest_factory().create_guest(Box::new(disk_config)); _test_multi_cpu(&guest); } + + #[test] + fn test_cpu_affinity() { + let disk_config = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); + let guest = GuestFactory::new_confidential_guest_factory() + .create_guest(Box::new(disk_config)) + .with_cpu(2); + _test_cpu_affinity(&guest); + } }