Skip to content

Commit da1c3b3

Browse files
zulinx86roypat
authored andcommitted
test: Check all vCPUs are online
As seen in #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]>
1 parent f59717c commit da1c3b3

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/framework/microvm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ def make_snapshot(
939939
snapshot_type=snapshot_type,
940940
meta={
941941
"kernel_file": str(self.kernel_file),
942+
"vcpus_count": self.vcpus_count,
942943
},
943944
)
944945

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""
5+
Test all vCPUs are configured correctly and work properly.
6+
7+
This test suite aims to catch bugs of Firecracker's vCPU configuration and
8+
CPU templates especially under multi-vCPU setup, by checking that all vCPUs
9+
are operating identically, except for the expected differences.
10+
"""
11+
12+
13+
def test_all_vcpus_online(uvm_any):
14+
"""Check all vCPUs are online inside guest"""
15+
assert (
16+
uvm_any.ssh.check_output("cat /sys/devices/system/cpu/online").stdout.strip()
17+
== f"0-{uvm_any.vcpus_count - 1}"
18+
)

0 commit comments

Comments
 (0)