2020-11-10 17:34:56 +00:00
|
|
|
// Copyright 2020 The Chromium OS Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
mod fixture;
|
2021-02-22 22:40:08 +00:00
|
|
|
use fixture::TestVm;
|
2020-11-10 17:34:56 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn boot_test_vm() {
|
2021-07-26 06:50:50 +00:00
|
|
|
let mut vm = TestVm::new(&[], false /* debug */, false /* o_direct */).unwrap();
|
|
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn boot_test_vm_odirect() {
|
|
|
|
let mut vm = TestVm::new(&[], false /* debug */, true /* o_direct */).unwrap();
|
2021-02-22 22:40:08 +00:00
|
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn boot_test_suspend_resume() {
|
|
|
|
// There is no easy way for us to check if the VM is actually suspended. But at
|
|
|
|
// least exercise the code-path.
|
2021-07-26 06:50:50 +00:00
|
|
|
let mut vm = TestVm::new(&[], false /* debug */, false /*o_direct */).unwrap();
|
2021-02-22 22:40:08 +00:00
|
|
|
vm.suspend().unwrap();
|
|
|
|
vm.resume().unwrap();
|
2020-11-10 17:34:56 +00:00
|
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
|
|
}
|