Lines Matching full:vm
14 use fixture::vm::Config;
15 use fixture::vm::TestVm;
22 fn get_swap_state(vm: &mut TestVm) -> SwapState { in get_swap_state()
23 let output = vm.swap_command("status").unwrap(); in get_swap_state()
29 vm: &mut TestVm, in wait_until_swap_state_change()
36 let current_state = get_swap_state(vm); in wait_until_swap_state_change()
58 fn create_tmpfs_file_in_guest(vm: &mut TestVm, size: usize) { in create_tmpfs_file_in_guest()
59 vm.exec_in_guest("mount -t tmpfs -o size=64m /dev/shm /tmp") in create_tmpfs_file_in_guest()
61 vm.exec_in_guest(&format!( in create_tmpfs_file_in_guest()
68 fn load_checksum_tmpfs_file(vm: &mut TestVm) -> String { in load_checksum_tmpfs_file()
71 vm.exec_in_guest(&format!("cat {} | sha256sum", SWAP_FILE_PATH)) in load_checksum_tmpfs_file()
81 let mut vm = TestVm::new_sudo(config).unwrap(); in swap_enabled_impl() localVariable
83 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in swap_enabled_impl()
84 vm.swap_command("enable").unwrap(); in swap_enabled_impl()
85 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in swap_enabled_impl()
86 vm.swap_command("trim").unwrap(); in swap_enabled_impl()
88 &mut vm, in swap_enabled_impl()
94 vm.swap_command("out").unwrap(); in swap_enabled_impl()
96 &mut vm, in swap_enabled_impl()
102 vm.swap_command("disable").unwrap(); in swap_enabled_impl()
104 &mut vm, in swap_enabled_impl()
122 let mut vm = TestVm::new_sudo(config).unwrap(); in swap_out_multiple_times_impl() localVariable
124 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in swap_out_multiple_times_impl()
125 vm.swap_command("enable").unwrap(); in swap_out_multiple_times_impl()
126 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in swap_out_multiple_times_impl()
127 vm.swap_command("trim").unwrap(); in swap_out_multiple_times_impl()
129 &mut vm, in swap_out_multiple_times_impl()
135 vm.swap_command("out").unwrap(); in swap_out_multiple_times_impl()
137 &mut vm, in swap_out_multiple_times_impl()
143 vm.swap_command("enable").unwrap(); in swap_out_multiple_times_impl()
144 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in swap_out_multiple_times_impl()
145 vm.swap_command("trim").unwrap(); in swap_out_multiple_times_impl()
147 &mut vm, in swap_out_multiple_times_impl()
153 vm.swap_command("out").unwrap(); in swap_out_multiple_times_impl()
155 &mut vm, in swap_out_multiple_times_impl()
161 vm.swap_command("enable").unwrap(); in swap_out_multiple_times_impl()
162 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in swap_out_multiple_times_impl()
163 vm.swap_command("disable").unwrap(); in swap_out_multiple_times_impl()
165 &mut vm, in swap_out_multiple_times_impl()
183 let mut vm = TestVm::new_sudo(config).unwrap(); in swap_disabled_without_swapped_out_impl() localVariable
185 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in swap_disabled_without_swapped_out_impl()
186 vm.swap_command("enable").unwrap(); in swap_disabled_without_swapped_out_impl()
187 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in swap_disabled_without_swapped_out_impl()
188 vm.swap_command("disable").unwrap(); in swap_disabled_without_swapped_out_impl()
190 &mut vm, in swap_disabled_without_swapped_out_impl()
208 let mut vm = TestVm::new_sudo(config).unwrap(); in stopped_with_swap_enabled_impl() localVariable
210 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in stopped_with_swap_enabled_impl()
211 vm.swap_command("enable").unwrap(); in stopped_with_swap_enabled_impl()
212 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in stopped_with_swap_enabled_impl()
213 vm.swap_command("trim").unwrap(); in stopped_with_swap_enabled_impl()
215 &mut vm, in stopped_with_swap_enabled_impl()
221 vm.swap_command("out").unwrap(); in stopped_with_swap_enabled_impl()
223 &mut vm, in stopped_with_swap_enabled_impl()
242 let mut vm = TestVm::new_sudo(config).unwrap(); in memory_contents_preserved_while_vmm_swap_enabled_impl() localVariable
243 create_tmpfs_file_in_guest(&mut vm, 1024 * 1024); in memory_contents_preserved_while_vmm_swap_enabled_impl()
244 let checksum = load_checksum_tmpfs_file(&mut vm); in memory_contents_preserved_while_vmm_swap_enabled_impl()
246 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in memory_contents_preserved_while_vmm_swap_enabled_impl()
247 vm.swap_command("enable").unwrap(); in memory_contents_preserved_while_vmm_swap_enabled_impl()
248 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in memory_contents_preserved_while_vmm_swap_enabled_impl()
250 assert_eq!(load_checksum_tmpfs_file(&mut vm), checksum); in memory_contents_preserved_while_vmm_swap_enabled_impl()
263 let mut vm = TestVm::new_sudo(config).unwrap(); in memory_contents_preserved_after_vmm_swap_out_impl() localVariable
264 create_tmpfs_file_in_guest(&mut vm, 1024 * 1024); in memory_contents_preserved_after_vmm_swap_out_impl()
265 let checksum = load_checksum_tmpfs_file(&mut vm); in memory_contents_preserved_after_vmm_swap_out_impl()
267 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in memory_contents_preserved_after_vmm_swap_out_impl()
268 vm.swap_command("enable").unwrap(); in memory_contents_preserved_after_vmm_swap_out_impl()
269 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in memory_contents_preserved_after_vmm_swap_out_impl()
270 vm.swap_command("trim").unwrap(); in memory_contents_preserved_after_vmm_swap_out_impl()
272 &mut vm, in memory_contents_preserved_after_vmm_swap_out_impl()
278 vm.swap_command("out").unwrap(); in memory_contents_preserved_after_vmm_swap_out_impl()
280 &mut vm, in memory_contents_preserved_after_vmm_swap_out_impl()
287 assert_eq!(load_checksum_tmpfs_file(&mut vm), checksum); in memory_contents_preserved_after_vmm_swap_out_impl()
300 let mut vm = TestVm::new_sudo(config).unwrap(); in memory_contents_preserved_after_vmm_swap_disabled_impl() localVariable
301 create_tmpfs_file_in_guest(&mut vm, 1024 * 1024); in memory_contents_preserved_after_vmm_swap_disabled_impl()
302 let checksum = load_checksum_tmpfs_file(&mut vm); in memory_contents_preserved_after_vmm_swap_disabled_impl()
304 assert_eq!(get_swap_state(&mut vm), SwapState::Ready); in memory_contents_preserved_after_vmm_swap_disabled_impl()
305 vm.swap_command("enable").unwrap(); in memory_contents_preserved_after_vmm_swap_disabled_impl()
306 assert_eq!(get_swap_state(&mut vm), SwapState::Pending); in memory_contents_preserved_after_vmm_swap_disabled_impl()
307 vm.swap_command("trim").unwrap(); in memory_contents_preserved_after_vmm_swap_disabled_impl()
309 &mut vm, in memory_contents_preserved_after_vmm_swap_disabled_impl()
315 vm.swap_command("out").unwrap(); in memory_contents_preserved_after_vmm_swap_disabled_impl()
317 &mut vm, in memory_contents_preserved_after_vmm_swap_disabled_impl()
323 vm.swap_command("disable").unwrap(); in memory_contents_preserved_after_vmm_swap_disabled_impl()
325 &mut vm, in memory_contents_preserved_after_vmm_swap_disabled_impl()
332 assert_eq!(load_checksum_tmpfs_file(&mut vm), checksum); in memory_contents_preserved_after_vmm_swap_disabled_impl()