Skip to content

Commit ff75bd5

Browse files
committed
test: Use fingerprint verify command
Now that the fingerprint verify command is available, replaces dump + compare commands with verify command. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent dd6ff2c commit ff75bd5

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

tests/integration_tests/functional/test_cpu_template_helper.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ def fingerprint_compare(
6666
cmd += f" --filters {' '.join(filters)}"
6767
utils.run_cmd(cmd)
6868

69+
def fingerprint_verify(self, baseline_path, output_path, filters):
70+
"""Verify the given baseline fingerprint."""
71+
cmd = (
72+
f"{self.binary} fingerprint verify"
73+
f"--baseline {baseline_path} --output {output_path}"
74+
)
75+
if filters:
76+
cmd += f" --filters {' '.join(filters)}"
77+
utils.run_cmd(cmd)
78+
6979

7080
@pytest.fixture(scope="session", name="cpu_template_helper")
7181
def cpu_template_helper_fixture():
@@ -320,12 +330,15 @@ def test_cpu_config_dump_vs_actual(
320330
), f"Mismatched MSR for {key:#010x}: {actual=:#066b} vs. {dump=:#066b}"
321331

322332

323-
def detect_fingerprint_change(
324-
results_dir, cpu_template_helper, filters=None
325-
):
333+
@pytest.mark.no_block_pr
334+
@pytest.mark.skipif(
335+
global_props.host_linux_version not in SUPPORTED_HOST_KERNELS,
336+
reason=f"Supported kernels are {SUPPORTED_HOST_KERNELS}",
337+
)
338+
def test_guest_cpu_config_change(results_dir, cpu_template_helper):
326339
"""
327-
Compare fingerprint files with filters between one taken at the moment and
328-
a baseline file taken in a specific point in time.
340+
Verify that the guest CPU config has not changed since the baseline
341+
fingerprint was gathered.
329342
"""
330343
fname = f"fingerprint_{global_props.cpu_codename}_{global_props.host_linux_version}host.json"
331344

@@ -336,27 +349,10 @@ def detect_fingerprint_change(
336349
# Baseline fingerprint.
337350
baseline_path = TEST_RESOURCES_DIR / fname
338351

339-
# Compare with baseline
340-
cpu_template_helper.fingerprint_compare(
352+
# Verify the baseline fingerprint.
353+
cpu_template_helper.fingerprint_verify(
341354
baseline_path,
342355
fingerprint_path,
343-
filters,
344-
)
345-
346-
347-
@pytest.mark.no_block_pr
348-
@pytest.mark.skipif(
349-
global_props.host_linux_version not in SUPPORTED_HOST_KERNELS,
350-
reason=f"Supported kernels are {SUPPORTED_HOST_KERNELS}",
351-
)
352-
def test_guest_cpu_config_change(results_dir, cpu_template_helper):
353-
"""
354-
Verify that the guest CPU config has not changed since the baseline
355-
fingerprint was gathered.
356-
"""
357-
detect_fingerprint_change(
358-
results_dir,
359-
cpu_template_helper,
360356
["guest_cpu_config"],
361357
)
362358

0 commit comments

Comments
 (0)