crosvm/integration_tests/tests/boot.rs
Junichi Uekawa 7cbd02f109 crosvm: Add integration test case for O_DIRECT.
Make sure we keep booting.

BUG=b:190435784
BUG=b:184204645
TEST=boot tests (boot_test_suspend_resume, boot_test_vm) pass.

Change-Id: I586e555ae83759c88759e1aeb96a728785d0cf5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3055557
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-08-11 02:22:41 +00:00

27 lines
943 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::TestVm;
#[test]
fn boot_test_vm() {
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();
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(&[], false /* debug */, false /*o_direct */).unwrap();
vm.suspend().unwrap();
vm.resume().unwrap();
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
}