crosvm/integration_tests/tests/boot.rs
Keiichi Watanabe 0974be8042 integration_tests: Define Config struct
Define `struct Config` to specify crosvm arguments so it'll make it
easier to add more complicated arguments in future CLs.

BUG=b:220292205
TEST=./integration_tests/run

Change-Id: I89921e171a81071dbfc58d22b233e9c71abcdf54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686717
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-22 01:46:18 +00:00

27 lines
873 B
Rust

// 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;
use fixture::{Config, 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_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");
}