@@ -332,8 +332,6 @@ def test_cpu_rdmsr(
332
332
SNAPSHOT_RESTORE_SHARED_NAMES = {
333
333
"snapshot_artifacts_root_dir_wrmsr" : "snapshot_artifacts/wrmsr" ,
334
334
"snapshot_artifacts_root_dir_cpuid" : "snapshot_artifacts/cpuid" ,
335
- "msr_reader_host_fname" : DATA_FILES / "msr_reader.sh" ,
336
- "msr_reader_guest_fname" : "/tmp/msr_reader.sh" ,
337
335
"msrs_before_fname" : "msrs_before.txt" ,
338
336
"msrs_after_fname" : "msrs_after.txt" ,
339
337
"cpuid_before_fname" : "cpuid_before.txt" ,
@@ -342,16 +340,12 @@ def test_cpu_rdmsr(
342
340
# fmt: on
343
341
344
342
345
- def dump_msr_state_to_file (dump_fname , ssh_conn , shared_names ):
343
+ def dump_msr_state_to_file (msr_reader_bin , dump_fname , ssh_conn ):
346
344
"""
347
345
Read MSR state via SSH and dump it into a file.
348
346
"""
349
- ssh_conn .scp_put (
350
- shared_names ["msr_reader_host_fname" ], shared_names ["msr_reader_guest_fname" ]
351
- )
352
- _ , stdout , stderr = ssh_conn .run (
353
- shared_names ["msr_reader_guest_fname" ], timeout = None
354
- )
347
+ ssh_conn .scp_put (msr_reader_bin , "/tmp/msr_reader" )
348
+ _ , stdout , stderr = ssh_conn .run ("/tmp/msr_reader" )
355
349
assert stderr == ""
356
350
357
351
with open (dump_fname , "w" , encoding = "UTF-8" ) as file :
@@ -364,7 +358,9 @@ def dump_msr_state_to_file(dump_fname, ssh_conn, shared_names):
364
358
)
365
359
@pytest .mark .timeout (900 )
366
360
@pytest .mark .nonci
367
- def test_cpu_wrmsr_snapshot (microvm_factory , guest_kernel , rootfs , cpu_template_any ):
361
+ def test_cpu_wrmsr_snapshot (
362
+ msr_reader_bin , microvm_factory , guest_kernel , rootfs , cpu_template_any
363
+ ):
368
364
"""
369
365
This is the first part of the test verifying
370
366
that MSRs retain their values after restoring from a snapshot.
@@ -424,7 +420,7 @@ def test_cpu_wrmsr_snapshot(microvm_factory, guest_kernel, rootfs, cpu_template_
424
420
425
421
msrs_before_fname = snapshot_artifacts_dir / shared_names ["msrs_before_fname" ]
426
422
427
- dump_msr_state_to_file (msrs_before_fname , vm .ssh , shared_names )
423
+ dump_msr_state_to_file (msr_reader_bin , msrs_before_fname , vm .ssh )
428
424
# On T2A, the restore test fails with error "cannot allocate memory" so,
429
425
# adding delay below as a workaround to unblock the tests for now.
430
426
# TODO: Debug the issue and remove this delay. Create below issue to track this:
@@ -470,7 +466,9 @@ def check_msrs_are_equal(before_recs, after_recs):
470
466
)
471
467
@pytest .mark .timeout (900 )
472
468
@pytest .mark .nonci
473
- def test_cpu_wrmsr_restore (microvm_factory , cpu_template_any , guest_kernel ):
469
+ def test_cpu_wrmsr_restore (
470
+ msr_reader_bin , microvm_factory , cpu_template_any , guest_kernel
471
+ ):
474
472
"""
475
473
This is the second part of the test verifying
476
474
that MSRs retain their values after restoring from a snapshot.
@@ -503,7 +501,7 @@ def test_cpu_wrmsr_restore(microvm_factory, cpu_template_any, guest_kernel):
503
501
504
502
# Dump MSR state to a file for further comparison
505
503
msrs_after_fname = snapshot_artifacts_dir / shared_names ["msrs_after_fname" ]
506
- dump_msr_state_to_file (msrs_after_fname , vm .ssh , shared_names )
504
+ dump_msr_state_to_file (msr_reader_bin , msrs_after_fname , vm .ssh )
507
505
msrs_before_fname = snapshot_artifacts_dir / shared_names ["msrs_before_fname" ]
508
506
509
507
# Compare the two lists of MSR values and assert they are equal
0 commit comments