From d330d91e1a8136fe202083137163ebc615c90393 Mon Sep 17 00:00:00 2001 From: Michael Zhao Date: Thu, 24 Jun 2021 11:07:06 +0800 Subject: [PATCH] tests: Optimize integration test on AArch64 AArch64 tests were divided into 2 steps: - Build and test with 'acpi' feature - Build and test without 'acpi' This can be optimized. We need only to build and test once with default features ('acpi' is enabled). On AArch64, ACPI only works with UEFI. If UEFI is not available, guest kernel fall back to use FDT. Most AArch64 test cases boot from direct kernel, the guest will keep using FDT even if ACPI is enabled. So nothing is broken. Signed-off-by: Michael Zhao --- scripts/run_integration_tests_aarch64.sh | 23 ++++------------------- tests/integration.rs | 12 +++++++++--- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index d61003ad1..77d4f829a 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -253,10 +253,8 @@ if [[ "$hypervisor" = "mshv" ]]; then exit 1 fi -features_build_fdt="--no-default-features --features $hypervisor" -features_build_acpi="--no-default-features --features $hypervisor,acpi" -features_test_fdt="--no-default-features --features integration_tests,$hypervisor" -features_test_acpi="--no-default-features --features integration_tests,$hypervisor,acpi" +features_build="" +features_test="--features integration_tests" # lock the workloads folder to avoid parallel updating by different containers ( @@ -283,7 +281,7 @@ fi export RUST_BACKTRACE=1 # Test without ACPI -cargo build --all --release $features_build_fdt --target $BUILD_TARGET +cargo build --all --release $features_build --target $BUILD_TARGET strip target/$BUILD_TARGET/release/cloud-hypervisor strip target/$BUILD_TARGET/release/vhost_user_net strip target/$BUILD_TARGET/release/ch-remote @@ -301,20 +299,7 @@ ovs-vsctl init ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true service openvswitch-switch restart -time cargo test $features_test_fdt "tests::parallel::$test_filter" +time cargo test $features_test "tests::parallel::$test_filter" RES=$? -echo "Integration test on FDT finished with result $RES." - -if [ $RES -eq 0 ]; then - # Test with EDK2 + ACPI - cargo build --all --release $features_build_acpi --target $BUILD_TARGET - strip target/$BUILD_TARGET/release/cloud-hypervisor - strip target/$BUILD_TARGET/release/vhost_user_net - strip target/$BUILD_TARGET/release/ch-remote - - time cargo test $features_test_acpi "tests::parallel::test_edk2_acpi_launch" - RES=$? - echo "Integration test on UEFI & ACPI finished with result $RES." -fi exit $RES diff --git a/tests/integration.rs b/tests/integration.rs index e7e52e99b..cb7ce32a1 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1039,7 +1039,7 @@ mod tests { ); // ACPI feature is needed. - #[cfg(feature = "acpi")] + #[cfg(all(target_arch = "x86_64", feature = "acpi"))] { guest.enable_memory_hotplug(); @@ -1179,7 +1179,7 @@ mod tests { ); // ACPI feature is needed. - #[cfg(feature = "acpi")] + #[cfg(all(target_arch = "x86_64", feature = "acpi"))] { guest.enable_memory_hotplug(); @@ -1383,7 +1383,7 @@ mod tests { ); // ACPI feature is needed. - #[cfg(feature = "acpi")] + #[cfg(all(target_arch = "x86_64", feature = "acpi"))] { guest.enable_memory_hotplug(); @@ -4165,6 +4165,12 @@ mod tests { thread::sleep(std::time::Duration::new(20, 0)); let r = std::panic::catch_unwind(|| { + // On AArch64 when acpi is enabled, there is a 4 MiB gap between the RAM + // that the VMM gives and the guest can see. + // This is a temporary solution, will be fixed in future. + #[cfg(all(target_arch = "aarch64", feature = "acpi"))] + let guest_memory_size_kb = guest_memory_size_kb - 4 * 1024; + let overhead = get_vmm_overhead(child.id(), guest_memory_size_kb); eprintln!( "Guest memory overhead: {} vs {}",