about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-13 23:03:27 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2024-04-14 11:30:29 +0200
commit37df49059dd1ba8039f12058ef590df6519e1a8b (patch)
tree65e0bbfcadf3c74cfb3a92cfd42ad10d7fc455c9 /src
parent6d9175f98e78118dd2467f285b16663842be5b61 (diff)
downloadrust-37df49059dd1ba8039f12058ef590df6519e1a8b.tar.gz
rust-37df49059dd1ba8039f12058ef590df6519e1a8b.zip
update README and add COMPILETEST_VERBOSE_CRASHES env var which when set print stdout, stderr and exit code of "crashes" tests, useful for debugging or adding new tests
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/runtest.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 759b07abc6e..38d22fef113 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -364,16 +364,21 @@ impl<'test> TestCx<'test> {
     fn run_crash_test(&self) {
         let pm = self.pass_mode();
         let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
-        /*
-        eprintln!("{}", proc_res.status);
-        eprintln!("{}", proc_res.stdout);
-        eprintln!("{}", proc_res.stderr);
-        eprintln!("{}", proc_res.cmdline);
-        */
+
+        if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
+            eprintln!("{}", proc_res.status);
+            eprintln!("{}", proc_res.stdout);
+            eprintln!("{}", proc_res.stderr);
+            eprintln!("{}", proc_res.cmdline);
+        }
 
         // if a test does not crash, consider it an error
         if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) {
-            self.fatal(&format!("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit"));
+            self.fatal(&format!(
+                "test no longer crashes/triggers ICE! Please give it a mearningful name, \
+            add a doc-comment to the start of the test explaining why it exists and \
+            move it to tests/ui or wherever you see fit."
+            ));
         }
     }