Skip to content

Commit cda58bd

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 11efbee commit cda58bd

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

+10-28
Original file line numberDiff line numberDiff line change
@@ -370,33 +370,15 @@ def test_json_static_templates(cpu_template_helper, tmp_path, custom_cpu_templat
370370
cpu_template_helper.template_verify(custom_cpu_template_path)
371371

372372

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

0 commit comments

Comments
 (0)