diff --git a/tests/integration.rs b/tests/integration.rs index 630bb89d3..75c42dcb9 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -18,13 +18,14 @@ extern crate lazy_static; mod tests { #![allow(dead_code)] use ssh2::Session; + use std::ffi::OsStr; use std::fs; use std::io; use std::io::BufRead; use std::io::{Read, Write}; use std::net::TcpStream; use std::path::Path; - use std::process::{Command, Stdio}; + use std::process::{Child, Command, Stdio}; use std::string::String; use std::sync::Mutex; use std::thread; @@ -712,6 +713,31 @@ mod tests { } } + struct GuestCommand { + command: Command, + } + + impl GuestCommand { + fn new() -> Self { + Self { + command: Command::new("target/release/cloud-hypervisor"), + } + } + + fn spawn(&mut self) -> io::Result { + self.command.stderr(Stdio::piped()).stdout(Stdio::piped()).spawn() + } + + fn args(&mut self, args: I) -> &mut Self + where + I: IntoIterator, + S: AsRef, + { + self.command.args(args); + self + } + } + #[cfg_attr(not(feature = "mmio"), test)] fn test_simple_launch() { test_block!(tb, "", {