Skip to content

Commit 9121488

Browse files
committed
test: Put fingerprint files under test_results dir
When changes on fingerprints are detected, it would be helpful that the current fingerprints are uploaded as buildkite artifacts. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 16190bc commit 9121488

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/integration_tests/functional/test_cpu_template_helper.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,27 +355,26 @@ def test_cpu_config_dump_vs_actual(
355355
), f"Mismatched MSR for {key:#010x}: {actual=:#066b} vs. {dump=:#066b}"
356356

357357

358-
def detect_fingerprint_change(microvm, tmp_path, cpu_template_helper, filters=None):
358+
def detect_fingerprint_change(
359+
microvm, tmp_path, results_dir, cpu_template_helper, filters=None
360+
):
359361
"""
360362
Compare fingerprint files with filters between one taken at the moment and
361363
a baseline file taken in a specific point in time.
362364
"""
365+
fname = f"fingerprint_{global_props.cpu_codename}_{global_props.host_linux_version}host.json"
366+
363367
# Generate VM config from test_microvm_with_api
364368
microvm.spawn()
365369
microvm.basic_config()
366370
vm_config_path = save_vm_config(microvm, tmp_path)
367371

368372
# Dump a fingerprint with the generated VM config.
369-
fingerprint_path = tmp_path / "fingerprint.json"
373+
fingerprint_path = results_dir / fname
370374
cpu_template_helper.fingerprint_dump(vm_config_path, fingerprint_path)
371375

372376
# Baseline fingerprint.
373-
baseline_path = (
374-
TEST_RESOURCES_DIR
375-
/ f"fingerprint_{global_props.cpu_codename}_{global_props.host_linux_version}host.json"
376-
)
377-
# Use this code to generate baseline fingerprint.
378-
# cpu_template_helper.fingerprint_dump(vm_config_path, baseline_path)
377+
baseline_path = TEST_RESOURCES_DIR / fname
379378

380379
# Compare with baseline
381380
cpu_template_helper.fingerprint_compare(
@@ -390,14 +389,17 @@ def detect_fingerprint_change(microvm, tmp_path, cpu_template_helper, filters=No
390389
global_props.host_linux_version not in SUPPORTED_HOST_KERNELS,
391390
reason=f"Supported kernels are {SUPPORTED_HOST_KERNELS}",
392391
)
393-
def test_guest_cpu_config_change(test_microvm_with_api, tmp_path, cpu_template_helper):
392+
def test_guest_cpu_config_change(
393+
test_microvm_with_api, tmp_path, results_dir, cpu_template_helper
394+
):
394395
"""
395396
Verify that the guest CPU config has not changed since the baseline
396397
fingerprint was gathered.
397398
"""
398399
detect_fingerprint_change(
399400
test_microvm_with_api,
400401
tmp_path,
402+
results_dir,
401403
cpu_template_helper,
402404
["guest_cpu_config"],
403405
)

0 commit comments

Comments
 (0)