Skip to content

Commit 89c4fce

Browse files
committed
feat(cpu-feauter-x86_64): add after snapshot test
Add verification of cpu features after loading a snapshot of a vm with cpu-template applied. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
1 parent cd2013b commit 89c4fce

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/integration_tests/functional/test_cpu_features.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import framework.utils_cpuid as cpuid_utils
2121
from framework import utils
2222
from framework.defs import SUPPORTED_HOST_KERNELS
23+
from framework.microvm import SnapshotType
2324
from framework.properties import global_props
2425
from framework.utils_cpu_templates import SUPPORTED_CPU_TEMPLATES
2526

@@ -628,7 +629,7 @@ def test_cpu_cpuid_restore(microvm_factory, guest_kernel, msr_cpu_template):
628629
PLATFORM != "x86_64", reason="CPU features are masked only on x86_64."
629630
)
630631
@pytest.mark.parametrize("cpu_template", ["T2", "T2S", "C3"])
631-
def test_cpu_template(test_microvm_with_api, cpu_template):
632+
def test_cpu_template(test_microvm_with_api, cpu_template, microvm_factory):
632633
"""
633634
Test masked and enabled cpu features against the expected template.
634635
@@ -657,6 +658,13 @@ def test_cpu_template(test_microvm_with_api, cpu_template):
657658
check_masked_features(test_microvm, cpu_template)
658659
check_enabled_features(test_microvm, cpu_template)
659660

661+
snapshot = test_microvm.make_snapshot(SnapshotType.FULL)
662+
restored_vm = microvm_factory.build()
663+
restored_vm.spawn()
664+
restored_vm.restore_from_snapshot(snapshot, resume=True)
665+
check_masked_features(restored_vm, cpu_template)
666+
check_enabled_features(restored_vm, cpu_template)
667+
660668

661669
def check_masked_features(test_microvm, cpu_template):
662670
"""Verify the masked features of the given template."""

0 commit comments

Comments
 (0)