Skip to content

Commit 89d7013

Browse files
committed
ci: Read test output from stderr
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
1 parent bbf929d commit 89d7013

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ci/runtest-android.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222
.arg(&test)
2323
.arg(&dst)
2424
.status()
25-
.expect("failed to run: adb pushr");
25+
.expect("failed to run: adb push");
2626
assert!(status.success());
2727

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

36+
let stdout = String::from_utf8_lossy(&output.stdout);
37+
let stderr = String::from_utf8_lossy(&output.stderr);
38+
3639
println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
3740
output.status,
38-
String::from_utf8_lossy(&output.stdout),
39-
String::from_utf8_lossy(&output.stderr));
41+
stdout,
42+
stderr);
4043

41-
let stdout = String::from_utf8_lossy(&output.stdout);
42-
stdout.lines().find(|l|
43-
(l.starts_with("PASSED ") && l.contains(" tests")) ||
44-
l.starts_with("test result: ok")
45-
).unwrap_or_else(|| {
44+
if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
45+
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
46+
{
4647
panic!("failed to find successful test run");
47-
});
48+
};
4849
}

0 commit comments

Comments
 (0)