diff --git a/integration_tests/tests/boot.rs b/integration_tests/tests/boot.rs index 877610c2c3..4305990197 100644 --- a/integration_tests/tests/boot.rs +++ b/integration_tests/tests/boot.rs @@ -6,7 +6,13 @@ use fixture::TestVm; #[test] fn boot_test_vm() { - let mut vm = TestVm::new(&[], false).unwrap(); + 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"); } @@ -14,7 +20,7 @@ fn boot_test_vm() { 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).unwrap(); + 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"); diff --git a/integration_tests/tests/fixture.rs b/integration_tests/tests/fixture.rs index c1b762db7f..94b2ed2d18 100644 --- a/integration_tests/tests/fixture.rs +++ b/integration_tests/tests/fixture.rs @@ -230,16 +230,21 @@ impl TestVm { } /// Configures the VM kernel and rootfs to load from the guest_under_test assets. - fn configure_kernel(command: &mut Command) { + fn configure_kernel(command: &mut Command, o_direct: bool) { + let rootfs_and_option = format!( + "{}{}", + rootfs_path().to_str().unwrap(), + if o_direct { ",o_direct=true" } else { "" } + ); command - .args(&["--root", rootfs_path().to_str().unwrap()]) + .args(&["--root", &rootfs_and_option]) .args(&["--params", "init=/bin/delegate"]) .arg(kernel_path()); } /// Instanciate a new crosvm instance. The first call will trigger the download of prebuilt /// files if necessary. - pub fn new(additional_arguments: &[&str], debug: bool) -> Result { + pub fn new(additional_arguments: &[&str], debug: bool, o_direct: bool) -> Result { static PREP_ONCE: Once = Once::new(); PREP_ONCE.call_once(|| TestVm::initialize_once()); @@ -258,7 +263,7 @@ impl TestVm { command.args(&["--socket", &control_socket_path.to_str().unwrap()]); command.args(additional_arguments); - TestVm::configure_kernel(&mut command); + TestVm::configure_kernel(&mut command, o_direct); println!("$ {:?}", command); if !debug {