mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: Return stderr when executing commands
If we want to test for error cases, it can be useful to inspect the `stderr` of a `Command` to analyze the errors. For example, this allows us to ensure that a `Command` returns an `IoError` by parsing the error trace, if an `IoError` is expected. This commit prepares the implementation of negative integration tests for the configurable BDFs. Signed-off-by: Pascal Scholz <pascal.scholz@cyberus-technology.de> On-behalf-of: SAP pascal.scholz@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
b4723999f8
commit
8259f92909
@@ -1981,7 +1981,7 @@ pub fn remote_command_w_output(
|
||||
api_socket: &str,
|
||||
command: &str,
|
||||
arg: Option<&str>,
|
||||
) -> (bool, Vec<u8>) {
|
||||
) -> (bool, Vec<u8> /* stdout */, Vec<u8> /* stderr */) {
|
||||
let mut cmd = Command::new(clh_command("ch-remote"));
|
||||
cmd.args([&format!("--api-socket={api_socket}"), command]);
|
||||
|
||||
@@ -1991,7 +1991,7 @@ pub fn remote_command_w_output(
|
||||
|
||||
let output = cmd.output().expect("Failed to launch ch-remote");
|
||||
|
||||
(output.status.success(), output.stdout)
|
||||
(output.status.success(), output.stdout, output.stderr)
|
||||
}
|
||||
|
||||
pub fn parse_iperf3_output(output: &[u8], sender: bool, bandwidth: bool) -> Result<f64, Error> {
|
||||
|
||||
Reference in New Issue
Block a user