diff --git a/tests/integration_tests/functional/test_cpu_multiple.py b/tests/integration_tests/functional/test_cpu_multiple.py index 60b52cd2f9c..c64629d1d92 100644 --- a/tests/integration_tests/functional/test_cpu_multiple.py +++ b/tests/integration_tests/functional/test_cpu_multiple.py @@ -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]