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 4, 2024
1 parent c181b69 commit fa07e9f
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 @@ -938,6 +938,7 @@ def make_snapshot(
ssh_key=self.ssh_key,
snapshot_type=snapshot_type,
meta={
"vcpus_count": self.vcpus_count,
"kernel_file": self.kernel_file,
},
)
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.
"""

import pytest


def test_all_vcpus_online(uvm_any):
"""Check all vCPUs are online inside guest"""
vm = uvm_any
for idx in range(vm.vcpus_count):
assert vm.ssh.check_output(f"cat /sys/devices/system/cpu/cpu{idx}/online").stdout == "1\n"

0 comments on commit fa07e9f

Please sign in to comment.