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 6, 2024
1 parent 3f70728 commit 7cecb56
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/integration_tests/functional/test_cpu_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,24 @@ def test_all_vcpus_online(uvm_any):
).stdout.strip()
== "1"
)


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 7cecb56

Please sign in to comment.