diff --git a/tests/framework/microvm.py b/tests/framework/microvm.py index 91b88cc4c28..eb755ffc5fa 100644 --- a/tests/framework/microvm.py +++ b/tests/framework/microvm.py @@ -939,6 +939,7 @@ def make_snapshot( snapshot_type=snapshot_type, meta={ "kernel_file": str(self.kernel_file), + "vcpus_count": self.vcpus_count, }, ) diff --git a/tests/integration_tests/functional/test_cpu_multiple.py b/tests/integration_tests/functional/test_cpu_multiple.py new file mode 100644 index 00000000000..1072a734ec9 --- /dev/null +++ b/tests/integration_tests/functional/test_cpu_multiple.py @@ -0,0 +1,19 @@ +# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +""" +Test all vCPUs are configured correctly and work properly. + +This test suite aims to catch bugs of Firecracker's vCPU configuration and +CPU templates especially under multi-vCPU setup, by checking that all vCPUs +are operating identically, except for the expected differences. +""" + + +def test_all_vcpus_online(uvm_any): + """Check all vCPUs are online inside guest""" + # pylint: disable=f-string-without-interpolation + assert ( + uvm_any.ssh.check_output(f"cat /sys/devices/system/cpu/online").stdout.strip() + == f"0-{uvm_any.vcpus_count - 1}" + )