Skip to content

Commit fbb59af

Browse files
committed
test: Check consecutive fingerprints consistency
Previously, only consecutive guest CPU configs were verified. A fingerprint contains not only guest CPU config but also host configuration. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 07fca17 commit fbb59af

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

tests/integration_tests/functional/test_cpu_template_helper.py

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -372,33 +372,15 @@ def test_json_static_templates(
372372
cpu_template_helper.template_verify(custom_cpu_template_path)
373373

374374

375-
def test_consecutive_cpu_config_consistency(cpu_template_helper, tmp_path):
375+
def test_consecutive_fingerprint_consistency(cpu_template_helper, tmp_path):
376376
"""
377-
Verify that two dumped guest CPU configs obtained consecutively are
378-
consistent. The dumped guest CPU config should not change without
379-
any environmental changes (firecracker, kernel, microcode updates).
377+
Verify that two fingerprints obtained consecutively are consisttent.
380378
"""
381-
# Dump CPU config with the helper tool.
382-
cpu_config_1 = tmp_path / "cpu_config_1.json"
383-
cpu_template_helper.template_dump(cpu_config_1)
384-
cpu_config_2 = tmp_path / "cpu_config_2.json"
385-
cpu_template_helper.template_dump(cpu_config_2)
386-
387-
# Strip common entries.
388-
cpu_template_helper.template_strip([cpu_config_1, cpu_config_2])
389-
390-
# Check the stripped result is empty.
391-
if PLATFORM == "x86_64":
392-
empty_cpu_config = {
393-
"cpuid_modifiers": [],
394-
"kvm_capabilities": [],
395-
"msr_modifiers": [],
396-
}
397-
elif PLATFORM == "aarch64":
398-
empty_cpu_config = {
399-
"kvm_capabilities": [],
400-
"reg_modifiers": [],
401-
"vcpu_features": [],
402-
}
403-
assert json.loads(cpu_config_1.read_text(encoding="utf-8")) == empty_cpu_config
404-
assert json.loads(cpu_config_2.read_text(encoding="utf-8")) == empty_cpu_config
379+
# Dump fingerprints with the helper tool.
380+
fingerprint_1 = tmp_path / "fingerprint_1.json"
381+
cpu_template_helper.fingerprint_dump(fingerprint_1)
382+
fingerprint_2 = tmp_path / "fingerprint_2.json"
383+
cpu_template_helper.fingerprint_dump(fingerprint_2)
384+
385+
# Compare them.
386+
cpu_template_helper.fingerprint_compare(fingerprint_1, fingerprint_2)

0 commit comments

Comments
 (0)