mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-11 12:35:26 +00:00
Add `boot_test_vm_config_file`, which boots a VM similar to `boot_test_vm`, but using a configuration file instead of command-line options wherever possible. BUG=b:218223240 TEST=cargo test -p e2e_tests boot_test_vm Change-Id: I45f82bfa8201776081e18c50011d928d8c7be0f0 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4022749 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Dennis Kempin <denniskempin@google.com>
35 lines
1 KiB
Rust
35 lines
1 KiB
Rust
// Copyright 2020 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
pub mod fixture;
|
|
use fixture::Config;
|
|
use fixture::TestVm;
|
|
|
|
#[test]
|
|
fn boot_test_vm() {
|
|
let mut vm = TestVm::new(Config::new()).unwrap();
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
}
|
|
|
|
#[test]
|
|
fn boot_test_vm_odirect() {
|
|
let mut vm = TestVm::new(Config::new().o_direct()).unwrap();
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
}
|
|
|
|
#[test]
|
|
fn boot_test_vm_config_file() {
|
|
let mut vm = TestVm::new_with_config_file(Config::new()).unwrap();
|
|
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.
|
|
let mut vm = TestVm::new(Config::new()).unwrap();
|
|
vm.suspend().unwrap();
|
|
vm.resume().unwrap();
|
|
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
|
|
}
|