about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-24 17:43:47 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2024-04-14 11:16:26 +0200
commit7048ce7e8fa441c7686b8a316ff5a551e8eea2f1 (patch)
tree302923b6a391f4f4dbfa0a05ada63d6ab543b325
parente09244fab28e0ec61459b3437d3c0ebc1bdb44cd (diff)
downloadrust-7048ce7e8fa441c7686b8a316ff5a551e8eea2f1.tar.gz
rust-7048ce7e8fa441c7686b8a316ff5a551e8eea2f1.zip
tidy: add tidy check agains \.rs files inside tests/crashes that are missing "//@ known-bug: "
-rw-r--r--src/tools/compiletest/src/runtest.rs2
-rw-r--r--src/tools/tidy/src/known_bug.rs17
-rw-r--r--src/tools/tidy/src/lib.rs1
-rw-r--r--src/tools/tidy/src/main.rs2
-rw-r--r--tests/crashes/span_delayed_bug.rs4
5 files changed, 21 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index e542cd49147..ae140962e40 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -354,7 +354,7 @@ impl<'test> TestCx<'test> {
         if self.props.should_ice {
             match proc_res.status.code() {
                 Some(101) => (),
-                _ => self.fatal("expected ICE"),
+                _ => self.fatal("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit"),
             }
         }
 
diff --git a/src/tools/tidy/src/known_bug.rs b/src/tools/tidy/src/known_bug.rs
new file mode 100644
index 00000000000..a62556f762b
--- /dev/null
+++ b/src/tools/tidy/src/known_bug.rs
@@ -0,0 +1,17 @@
+//! Tidy check to ensure that tests inside 'tests/crashes' have a '@known-bug' directive.
+
+use crate::walk::*;
+use std::path::Path;
+
+pub fn check(filepath: &Path, bad: &mut bool) {
+    walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| {
+        let file = entry.path();
+        if !contents.lines().any(|line| line.starts_with("//@ known-bug: ")) {
+            tidy_error!(
+                bad,
+                "{} crash/ice test does not have a \"//@ known-bug: \" directive",
+                file.display()
+            );
+        }
+    });
+}
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index 57436e8d7fe..23f303276aa 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -67,6 +67,7 @@ pub mod features;
 pub mod fluent_alphabetical;
 mod fluent_used;
 pub(crate) mod iter_header;
+pub mod known_bug;
 pub mod mir_opt_tests;
 pub mod pal;
 pub mod run_make_tests;
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index 93be4d61a9a..77691815830 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -35,6 +35,7 @@ fn main() {
     let library_path = root_path.join("library");
     let compiler_path = root_path.join("compiler");
     let librustdoc_path = src_path.join("librustdoc");
+    let crashes_path = tests_path.join("crashes");
 
     let args: Vec<String> = env::args().skip(1).collect();
     let (cfg_args, pos_args) = match args.iter().position(|arg| arg == "--") {
@@ -108,6 +109,7 @@ fn main() {
         check!(mir_opt_tests, &tests_path, bless);
         check!(rustdoc_gui_tests, &tests_path);
         check!(rustdoc_css_themes, &librustdoc_path);
+        check!(known_bug, &crashes_path);
 
         // Checks that only make sense for the compiler.
         check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
diff --git a/tests/crashes/span_delayed_bug.rs b/tests/crashes/span_delayed_bug.rs
deleted file mode 100644
index e410f730415..00000000000
--- a/tests/crashes/span_delayed_bug.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#![feature(rustc_attrs)]
-
-#[rustc_error(delayed_bug_from_inside_query)]
-fn main() {}