Skip to content

Commit

Permalink
test: Check all vCPUs are online
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 10, 2024
1 parent fb62df3 commit a7c78bf
Show file tree
Hide file tree
Showing 2 changed files with 19 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
18 changes: 18 additions & 0 deletions tests/integration_tests/functional/test_cpu_multiple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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"""
assert (
uvm_any.ssh.check_output("cat /sys/devices/system/cpu/online").stdout.strip()
== f"0-{uvm_any.vcpus_count - 1}"
)

0 comments on commit a7c78bf

Please sign in to comment.