about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-28 21:41:02 +0200
committerGitHub <noreply@github.com>2025-08-28 21:41:02 +0200
commit347dd4741f755c03d153e408073cc1b380c94d8c (patch)
tree94f1bd741ae9950898f484bcbf1642ebdb4908a2
parent56c68e78ddc8c111d0ad1a5ebf52646453730c80 (diff)
parent21de27c88a87a141003198ec0d9df789ca9c75cc (diff)
downloadrust-347dd4741f755c03d153e408073cc1b380c94d8c.tar.gz
rust-347dd4741f755c03d153e408073cc1b380c94d8c.zip
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.
-rw-r--r--src/bootstrap/src/utils/render_tests.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs
index 40006aca5c5..90fd57d976d 100644
--- a/src/bootstrap/src/utils/render_tests.rs
+++ b/src/bootstrap/src/utils/render_tests.rs
@@ -250,8 +250,14 @@ impl<'a> Renderer<'a> {
                 if failure.stdout.is_some() || failure.message.is_some() {
                     println!("---- {} stdout ----", failure.name);
                     if let Some(stdout) = &failure.stdout {
-                        println!("{stdout}");
+                        // Captured test output normally ends with a newline,
+                        // so only use `println!` if it doesn't.
+                        print!("{stdout}");
+                        if !stdout.ends_with('\n') {
+                            println!("\n\\ (no newline at end of output)");
+                        }
                     }
+                    println!("---- {} stdout end ----", failure.name);
                     if let Some(message) = &failure.message {
                         println!("NOTE: {message}");
                     }