Skip to content

Commit 79472a3

Browse files
committed
feat(cpu-features-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 b622bbf commit 79472a3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/integration_tests/functional/test_cpu_features.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ def test_cpu_cpuid_restore(microvm_factory, guest_kernel, msr_cpu_template):
628628
PLATFORM != "x86_64", reason="CPU features are masked only on x86_64."
629629
)
630630
@pytest.mark.parametrize("cpu_template", ["T2", "T2S", "C3"])
631-
def test_cpu_template(test_microvm_with_api, cpu_template):
631+
def test_cpu_template(test_microvm_with_api, cpu_template, microvm_factory):
632632
"""
633633
Test masked and enabled cpu features against the expected template.
634634
@@ -657,6 +657,15 @@ def test_cpu_template(test_microvm_with_api, cpu_template):
657657
check_masked_features(test_microvm, cpu_template)
658658
check_enabled_features(test_microvm, cpu_template)
659659

660+
# Check that cpu features are still correct
661+
# after snap/restore cycle.
662+
snapshot = test_microvm.snapshot_full()
663+
restored_vm = microvm_factory.build()
664+
restored_vm.spawn()
665+
restored_vm.restore_from_snapshot(snapshot, resume=True)
666+
check_masked_features(restored_vm, cpu_template)
667+
check_enabled_features(restored_vm, cpu_template)
668+
660669

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

0 commit comments

Comments
 (0)