@@ -46,7 +46,7 @@ def id(self):
4646        """Computes a unique id for this test instance""" 
4747        return  "all_dev"  if  self .all_devices  else  f"{ self .vcpus }  vcpu_{ self .mem }  mb" 
4848
49-     def  boot_vm (self , microvm_factory , guest_kernel , rootfs ) ->  Microvm :
49+     def  boot_vm (self , microvm_factory , guest_kernel , rootfs ,  secret_free ) ->  Microvm :
5050        """Creates the initial snapshot that will be loaded repeatedly to sample latencies""" 
5151        vm  =  microvm_factory .build (
5252            guest_kernel ,
@@ -60,6 +60,7 @@ def boot_vm(self, microvm_factory, guest_kernel, rootfs) -> Microvm:
6060            mem_size_mib = self .mem ,
6161            rootfs_io_engine = "Sync" ,
6262            huge_pages = self .huge_pages ,
63+             secret_free = secret_free ,
6364        )
6465
6566        for  _  in  range (self .nets ):
@@ -98,7 +99,12 @@ def boot_vm(self, microvm_factory, guest_kernel, rootfs) -> Microvm:
9899    ids = lambda  x : x .id , 
99100) 
100101def  test_restore_latency (
101-     microvm_factory , rootfs , guest_kernel_linux_5_10 , test_setup , metrics 
102+     microvm_factory ,
103+     rootfs ,
104+     guest_kernel_linux_5_10 ,
105+     test_setup ,
106+     metrics ,
107+     secret_free ,
102108):
103109    """ 
104110    Restores snapshots with vcpu/memory configuration, roughly scaling according to mem = (vcpus - 1) * 2048MB, 
@@ -116,7 +122,9 @@ def test_restore_latency(
116122            "huge pages with secret hiding kernels on ARM are currently failing" 
117123        )
118124
119-     vm  =  test_setup .boot_vm (microvm_factory , guest_kernel_linux_5_10 , rootfs )
125+     vm  =  test_setup .boot_vm (
126+         microvm_factory , guest_kernel_linux_5_10 , rootfs , secret_free 
127+     )
120128
121129    metrics .set_dimensions (
122130        {
@@ -159,6 +167,7 @@ def test_post_restore_latency(
159167    metrics ,
160168    uffd_handler ,
161169    huge_pages ,
170+     secret_free ,
162171):
163172    """Collects latency metric of post-restore memory accesses done inside the guest""" 
164173    if  huge_pages  !=  HugePagesConfig .NONE  and  uffd_handler  is  None :
@@ -174,7 +183,9 @@ def test_post_restore_latency(
174183        )
175184
176185    test_setup  =  SnapshotRestoreTest (mem = 1024 , vcpus = 2 , huge_pages = huge_pages )
177-     vm  =  test_setup .boot_vm (microvm_factory , guest_kernel_linux_5_10 , rootfs )
186+     vm  =  test_setup .boot_vm (
187+         microvm_factory , guest_kernel_linux_5_10 , rootfs , secret_free 
188+     )
178189
179190    metrics .set_dimensions (
180191        {
@@ -226,6 +237,7 @@ def test_population_latency(
226237    huge_pages ,
227238    vcpus ,
228239    mem ,
240+     secret_free ,
229241):
230242    """Collects population latency metrics (e.g. how long it takes UFFD handler to fault in all memory)""" 
231243    if  (
@@ -238,7 +250,9 @@ def test_population_latency(
238250        )
239251
240252    test_setup  =  SnapshotRestoreTest (mem = mem , vcpus = vcpus , huge_pages = huge_pages )
241-     vm  =  test_setup .boot_vm (microvm_factory , guest_kernel_linux_5_10 , rootfs )
253+     vm  =  test_setup .boot_vm (
254+         microvm_factory , guest_kernel_linux_5_10 , rootfs , secret_free 
255+     )
242256
243257    metrics .set_dimensions (
244258        {
@@ -281,16 +295,13 @@ def test_population_latency(
281295
282296
283297def  test_snapshot_create_latency (
284-     microvm_factory ,
285-     guest_kernel_linux_5_10 ,
286-     rootfs ,
287-     metrics ,
298+     microvm_factory , guest_kernel_linux_5_10 , rootfs , metrics , secret_free 
288299):
289300    """Measure the latency of creating a Full snapshot""" 
290301
291302    vm  =  microvm_factory .build (guest_kernel_linux_5_10 , rootfs , monitor_memory = False )
292303    vm .spawn ()
293-     vm .basic_config (vcpu_count = 2 , mem_size_mib = 512 )
304+     vm .basic_config (vcpu_count = 2 , mem_size_mib = 512 ,  secret_free = secret_free )
294305    vm .start ()
295306    vm .pin_threads (0 )
296307
0 commit comments