Skip to content

Commit 3289fff

Browse files
committed
tidy: add tidy check agains \.rs files inside tests/crashes that are missing "//@ known-bug: "
1 parent e86e801 commit 3289fff

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'test> TestCx<'test> {
354354
if self.props.should_ice {
355355
match proc_res.status.code() {
356356
Some(101) => (),
357-
_ => self.fatal("expected ICE"),
357+
_ => self.fatal("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit"),
358358
}
359359
}
360360

src/tools/tidy/src/known_bug.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Tidy check to ensure that tests inside 'tests/crashes' have a '@known-bug' directive.
2+
3+
use crate::walk::*;
4+
use std::path::Path;
5+
6+
pub fn check(filepath: &Path, bad: &mut bool) {
7+
walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| {
8+
let file = entry.path();
9+
if !contents.lines().any(|line| line.starts_with("//@ known-bug: ")) {
10+
tidy_error!(
11+
bad,
12+
"{} crash/ice test does not have a \"//@ known-bug: \" directive",
13+
file.display()
14+
);
15+
}
16+
});
17+
}

src/tools/tidy/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub mod features;
6767
pub mod fluent_alphabetical;
6868
mod fluent_used;
6969
pub(crate) mod iter_header;
70+
pub mod known_bug;
7071
pub mod mir_opt_tests;
7172
pub mod pal;
7273
pub mod run_make_tests;

src/tools/tidy/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fn main() {
3535
let library_path = root_path.join("library");
3636
let compiler_path = root_path.join("compiler");
3737
let librustdoc_path = src_path.join("librustdoc");
38+
let crashes_path = tests_path.join("crashes");
3839

3940
let args: Vec<String> = env::args().skip(1).collect();
4041
let (cfg_args, pos_args) = match args.iter().position(|arg| arg == "--") {
@@ -108,6 +109,7 @@ fn main() {
108109
check!(mir_opt_tests, &tests_path, bless);
109110
check!(rustdoc_gui_tests, &tests_path);
110111
check!(rustdoc_css_themes, &librustdoc_path);
112+
check!(known_bug, &crashes_path);
111113

112114
// Checks that only make sense for the compiler.
113115
check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);

tests/crashes/span_delayed_bug.rs

-4
This file was deleted.

0 commit comments

Comments
 (0)