Skip to content

Commit

Permalink
ci: Read test output from stderr
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor committed Nov 19, 2022
1 parent bbf929d commit 89d7013
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ci/runtest-android.rs
Expand Up @@ -22,7 +22,7 @@ fn main() {
.arg(&test)
.arg(&dst)
.status()
.expect("failed to run: adb pushr");
.expect("failed to run: adb push");
assert!(status.success());

let output = Command::new("adb")
Expand All @@ -33,16 +33,17 @@ fn main() {
.expect("failed to run: adb shell");
assert!(status.success());

let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);

println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status,
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr));
stdout,
stderr);

let stdout = String::from_utf8_lossy(&output.stdout);
stdout.lines().find(|l|
(l.starts_with("PASSED ") && l.contains(" tests")) ||
l.starts_with("test result: ok")
).unwrap_or_else(|| {
if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
{
panic!("failed to find successful test run");
});
};
}

0 comments on commit 89d7013

Please sign in to comment.