Skip to content

Commit 7048ce7

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

5 files changed

Lines changed: 21 additions & 5 deletions

File tree

‎src/tools/compiletest/src/runtest.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'test> TestCx<'test> {
354354
ifself.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‎

Lines changed: 17 additions & 0 deletions
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+
usecrate::walk::*;
4+
use std::path::Path;
5+
6+
pubfncheck(filepath:&Path,bad:&mutbool){
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‎

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

‎src/tools/tidy/src/main.rs‎

Lines changed: 2 additions & 0 deletions
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‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)