From 19d2fd9c477ec1724b2982ae0dc0b8fb24c62eae Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Mon, 6 Jun 2022 21:55:26 +0900 Subject: [PATCH] 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 Commit-Queue: Keiichi Watanabe Tested-by: kokoro --- integration_tests/tests/boot.rs | 6 +++--- integration_tests/tests/fixture.rs | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/integration_tests/tests/boot.rs b/integration_tests/tests/boot.rs index 4305990197..132c2e77c6 100644 --- a/integration_tests/tests/boot.rs +++ b/integration_tests/tests/boot.rs @@ -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"); diff --git a/integration_tests/tests/fixture.rs b/integration_tests/tests/fixture.rs index 256938613c..228168396b 100644 --- a/integration_tests/tests/fixture.rs +++ b/integration_tests/tests/fixture.rs @@ -154,7 +154,6 @@ pub struct TestVm { to_guest: File, control_socket_path: PathBuf, process: Option, // 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 { + pub fn new(additional_arguments: &[&str], o_direct: bool) -> Result { 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()) }