backcompat_test: improve readability of test failures
Print stdout/err as strings. Print the DTC to stderr instead of logcat
so that it gets forwarded to the main output of test tooling.
Test: atest avf_backcompat_tests
Change-Id: Icf6c46ae057d76163aae4e732381d286a832ffaf
diff --git a/tests/backcompat_test/src/main.rs b/tests/backcompat_test/src/main.rs
index b0cd042..5058e15 100644
--- a/tests/backcompat_test/src/main.rs
+++ b/tests/backcompat_test/src/main.rs
@@ -25,7 +25,6 @@
use anyhow::anyhow;
use anyhow::Context;
use anyhow::Error;
-use log::error;
use log::info;
use std::fs::read_to_string;
use std::fs::File;
@@ -189,15 +188,15 @@
return Err(anyhow!("failed to execute dtc"));
}
let dt2 = read_to_string("dump_dt_failed.dts")?;
- error!(
+ eprintln!(
"Device tree 2 does not match golden DT.\n
Device Tree 2: {}",
dt2
);
return Err(anyhow!(
- "stdout: {:?}\n stderr: {:?}",
- dtcompare_res.stdout,
- dtcompare_res.stderr
+ "stdout: {}\n stderr: {}",
+ String::from_utf8_lossy(&dtcompare_res.stdout),
+ String::from_utf8_lossy(&dtcompare_res.stderr)
));
}