Skip to content

Commit

Permalink
Auto merge of #3005 - JohnTitor:fix-android-ci, r=JohnTitor
Browse files Browse the repository at this point in the history
ci: Read test output from stderr

CI is currently failing because JohnTitor/ctest2#37 changed the place to display the test results and `runtest-android.rs` cannot find it on stdout. This PR fixes it by reading lines from stderr instead.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
bors committed Nov 19, 2022
2 parents bbf929d + 89d7013 commit 0b2b101
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 0b2b101

Please sign in to comment.