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:
Pascal Scholz
2026-03-25 19:34:56 +01:00
committed by Rob Bradford
parent b4723999f8
commit 8259f92909
4 changed files with 26 additions and 26 deletions

View File

@@ -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> {