Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Read test output from stderr #3005

Merged
merged 1 commit into from Nov 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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");
});
};
}