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 <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2021-06-24 11:07:06 +08:00 committed by Rob Bradford
parent 3613b4c096
commit d330d91e1a
2 changed files with 13 additions and 22 deletions

View File

@ -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

View File

@ -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 {}",