Skip to content

Commit 347dd47

Browse files
Rollup merge of #145920 - Zalathar:failure-stdout, r=jieyouxu
bootstrap: Explicitly mark the end of a failed test's captured output While working on some compiletest stuff, I noticed that when bootstrap prints a failed test's captured output, there's no indication of where that output actually ends. In addition to indicating where the captured output ends, this end marker also makes it easier to see the relevant test name when scrolling upwards in terminal output.
2 parents 56c68e7 + 21de27c commit 347dd47

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bootstrap/src/utils/render_tests.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,14 @@ impl<'a> Renderer<'a> {
250250
if failure.stdout.is_some() || failure.message.is_some() {
251251
println!("---- {} stdout ----", failure.name);
252252
if let Some(stdout) = &failure.stdout {
253-
println!("{stdout}");
253+
// Captured test output normally ends with a newline,
254+
// so only use `println!` if it doesn't.
255+
print!("{stdout}");
256+
if !stdout.ends_with('\n') {
257+
println!("\n\\ (no newline at end of output)");
258+
}
254259
}
260+
println!("---- {} stdout end ----", failure.name);
255261
if let Some(message) = &failure.message {
256262
println!("NOTE: {message}");
257263
}

0 commit comments

Comments
 (0)