diff --git a/tests/integration_tests/functional/test_cpu_multiple.py b/tests/integration_tests/functional/test_cpu_multiple.py index 677499fdcb4..7a071159221 100644 --- a/tests/integration_tests/functional/test_cpu_multiple.py +++ b/tests/integration_tests/functional/test_cpu_multiple.py @@ -18,3 +18,24 @@ def test_all_vcpus_online(uvm_any): vm.ssh.check_output(f"cat /sys/devices/system/cpu/cpu{idx}/online").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]