Skip to content

Commit

Permalink
test: Check all vCPUs are oneline
Browse files Browse the repository at this point in the history
As seen in firecracker-microvm#4925, a bad CPU template made secondary CPUs not come up. To
catch similar bugs of CPU templates, check all the vCPUs are online from
guests' perspective.

Signed-off-by: Takahiro Itazuri <[email protected]>
  • Loading branch information
zulinx86 committed Dec 9, 2024
1 parent fb62df3 commit db7720b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/framework/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ def make_snapshot(
snapshot_type=snapshot_type,
meta={
"kernel_file": str(self.kernel_file),
"vcpus_count": self.vcpus_count,
},
)

Expand Down
19 changes: 19 additions & 0 deletions tests/integration_tests/functional/test_cpu_multiple.py
Original file line number Diff line number Diff line change
@@ -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}"
)

0 comments on commit db7720b

Please sign in to comment.