integration_tests: Remove debug field

Remove `TestVm`'s `debug` field and print guest outputs unconditionally.
This won't make the test log messy because the output is hidden unless
the test case fails.

BUG=none
TEST=./integration_tests/run

Change-Id: Ica77492229b547f2e244f2751992869b00b78f7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686716
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Keiichi Watanabe 2022-06-06 21:55:26 +09:00 committed by Chromeos LUCI
parent 52d56f1d37
commit 19d2fd9c47
2 changed files with 6 additions and 9 deletions

View file

@ -6,13 +6,13 @@ use fixture::TestVm;
#[test]
fn boot_test_vm() {
let mut vm = TestVm::new(&[], false /* debug */, false /* o_direct */).unwrap();
let mut vm = TestVm::new(&[], 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();
let mut vm = TestVm::new(&[], true /* o_direct */).unwrap();
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");
}
@ -20,7 +20,7 @@ fn boot_test_vm_odirect() {
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();
let mut vm = TestVm::new(&[], false /*o_direct */).unwrap();
vm.suspend().unwrap();
vm.resume().unwrap();
assert_eq!(vm.exec_in_guest("echo 42").unwrap().trim(), "42");

View file

@ -154,7 +154,6 @@ pub struct TestVm {
to_guest: File,
control_socket_path: PathBuf,
process: Option<Child>, // Use `Option` to allow taking the ownership in `Drop::drop()`.
debug: bool,
}
impl TestVm {
@ -247,7 +246,7 @@ impl TestVm {
/// 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, o_direct: bool) -> Result<TestVm> {
pub fn new(additional_arguments: &[&str], o_direct: bool) -> Result<TestVm> {
static PREP_ONCE: Once = Once::new();
PREP_ONCE.call_once(TestVm::initialize_once);
@ -294,7 +293,6 @@ impl TestVm {
to_guest: to_guest?,
control_socket_path,
process,
debug,
})
}
@ -319,9 +317,8 @@ impl TestVm {
output.push_str(&line);
}
let trimmed = output.trim();
if self.debug {
println!("<- {:?}", trimmed);
}
println!("<- {:?}", trimmed);
Ok(trimmed.to_string())
}