tests: Print full commandline for better debugging

This patch prints the complete commandline when launching
cloud-hypervisor. It also prints the details of the `ssh` command if
the command is failing.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2020-10-14 10:22:15 -07:00 committed by Rob Bradford
parent 5867a1af4a
commit e869d2f1bc

View File

@ -532,6 +532,7 @@ mod tests {
cmd.status().expect("Failed to launch ch-remote").success() cmd.status().expect("Failed to launch ch-remote").success()
} }
#[derive(Debug)]
struct PasswordAuth { struct PasswordAuth {
username: String, username: String,
password: String, password: String,
@ -574,6 +575,16 @@ mod tests {
Err(e) => { Err(e) => {
counter += 1; counter += 1;
if counter >= retries { if counter >= retries {
eprintln!(
"\n\n==== Start ssh command output (FAILED) ====\n\n\
command=\"{}\"\n\
auth=\"{:#?}\"\n\
ip=\"{}\"\n\
output=\"{}\"\n\
\n==== End ssh command outout ====\n\n",
command, auth, ip, s
);
return Err(e); return Err(e);
} }
} }
@ -1004,6 +1015,13 @@ mod tests {
} }
fn spawn(&mut self) -> io::Result<Child> { fn spawn(&mut self) -> io::Result<Child> {
println!(
"\n\n==== Start cloud-hypervisor command-line ====\n\n\
{:?}\n\
\n==== End cloud-hypervisor command-line ====\n\n",
self.command
);
if self.capture_output { if self.capture_output {
let child = self let child = self
.command .command