Skip to content

Commit

Permalink
test: Check all vCPUs have the same features inside guest
Browse files Browse the repository at this point in the history
The test ensures Firecracker or CPU templates don't configure CPU
features differently between vCPUs.

Note that whether the printed CPU features are expected or not should be
tested in (arch-specific) test_cpu_features_*.py only for vCPU 0. Thus,
we only test the equivalence of all CPUs in the same guest.

Signed-off-by: Takahiro Itazuri <[email protected]>
  • Loading branch information
zulinx86 committed Dec 4, 2024
1 parent fa07e9f commit a9d07d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/integration_tests/functional/test_cpu_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,22 @@ def test_all_vcpus_online(uvm_any):
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"


def test_all_vcpus_have_same_features(uvm_any):
"""
Check all vCPUs have the same features inside guest.
This test ensures Firecracker or CPU templates don't configure CPU features
differently between vCPUs.
Note that whether the shown CPU features are expected or not should be
tested in (arch-specific) test_cpu_features_*.py only for vCPU 0. Thus, we
only test the equivalence of all CPUs in the same guest.
"""
vm = uvm_any

# Get features of all CPUs
features = vm.ssh.check_output("cat /proc/cpuinfo | grep Features").stdout.splitlines()
for idx in range(1, vm.vcpus_count):
assert features[0] == features[idx]

0 comments on commit a9d07d6

Please sign in to comment.