about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-03-27 13:11:19 -0400
committerGitHub <noreply@github.com>2025-03-27 13:11:19 -0400
commited752193ccb5cf19ee92f6b81dde08f989c34a7f (patch)
tree6393592c49243d83551e9efd54157a7afc084a29
parent322d1c197474a3fcbac47d302a40e3d3a3341442 (diff)
parent3d58aec0da0badcfdb9c185d317d6aa1c14ffb6e (diff)
downloadrust-ed752193ccb5cf19ee92f6b81dde08f989c34a7f.tar.gz
rust-ed752193ccb5cf19ee92f6b81dde08f989c34a7f.zip
Rollup merge of #138999 - jieyouxu:spellout-pass-mode, r=wesleywiser
Report compiletest pass mode if forced

This is very non-obvious if it fails in PR CI, because the starting invocation is miles away from the final test suite outcome.
-rw-r--r--src/tools/compiletest/src/lib.rs29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index 3ec984edacb..950566b2582 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -22,6 +22,7 @@ pub mod util;
 use core::panic;
 use std::collections::HashSet;
 use std::ffi::OsString;
+use std::fmt::Write;
 use std::io::{self, ErrorKind};
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
@@ -570,18 +571,22 @@ pub fn run_tests(config: Arc<Config>) {
             // easy to miss which tests failed, and as such fail to reproduce
             // the failure locally.
 
-            println!(
-                "Some tests failed in compiletest suite={}{} mode={} host={} target={}",
-                config.suite,
-                config
-                    .compare_mode
-                    .as_ref()
-                    .map(|c| format!(" compare_mode={:?}", c))
-                    .unwrap_or_default(),
-                config.mode,
-                config.host,
-                config.target
-            );
+            let mut msg = String::from("Some tests failed in compiletest");
+            write!(msg, " suite={}", config.suite).unwrap();
+
+            if let Some(compare_mode) = config.compare_mode.as_ref() {
+                write!(msg, " compare_mode={}", compare_mode).unwrap();
+            }
+
+            if let Some(pass_mode) = config.force_pass_mode.as_ref() {
+                write!(msg, " pass_mode={}", pass_mode).unwrap();
+            }
+
+            write!(msg, " mode={}", config.mode).unwrap();
+            write!(msg, " host={}", config.host).unwrap();
+            write!(msg, " target={}", config.target).unwrap();
+
+            println!("{msg}");
 
             std::process::exit(1);
         }