add header to compiletest to check for ice
This commit is contained in:
parent
5930551f6a
commit
6299c33022
2 changed files with 20 additions and 4 deletions
|
@ -376,6 +376,8 @@ pub struct TestProps {
|
|||
// If true, `rustfix` will only apply `MachineApplicable` suggestions.
|
||||
pub rustfix_only_machine_applicable: bool,
|
||||
pub assembly_output: Option<String>,
|
||||
// If true, the test is expected to ICE
|
||||
pub should_ice: bool,
|
||||
}
|
||||
|
||||
impl TestProps {
|
||||
|
@ -414,6 +416,7 @@ impl TestProps {
|
|||
run_rustfix: false,
|
||||
rustfix_only_machine_applicable: false,
|
||||
assembly_output: None,
|
||||
should_ice: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,6 +467,10 @@ impl TestProps {
|
|||
self.pp_exact = config.parse_pp_exact(ln, testfile);
|
||||
}
|
||||
|
||||
if !self.should_ice {
|
||||
self.should_ice = config.parse_should_ice(ln);
|
||||
}
|
||||
|
||||
if !self.build_aux_docs {
|
||||
self.build_aux_docs = config.parse_build_aux_docs(ln);
|
||||
}
|
||||
|
@ -688,6 +695,9 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {
|
|||
}
|
||||
|
||||
impl Config {
|
||||
fn parse_should_ice(&self, line: &str) -> bool {
|
||||
self.parse_name_directive(line, "should-ice")
|
||||
}
|
||||
fn parse_error_pattern(&self, line: &str) -> Option<String> {
|
||||
self.parse_name_value_directive(line, "error-pattern")
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ impl<'test> TestCx<'test> {
|
|||
fn run_cfail_test(&self) {
|
||||
let proc_res = self.compile_test();
|
||||
self.check_if_test_should_compile(&proc_res);
|
||||
self.check_no_compiler_crash(&proc_res);
|
||||
self.check_no_compiler_crash(&proc_res, self.props.should_ice);
|
||||
|
||||
let output_to_check = self.get_output(&proc_res);
|
||||
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
|
||||
|
@ -395,6 +395,12 @@ impl<'test> TestCx<'test> {
|
|||
} else {
|
||||
self.check_error_patterns(&output_to_check, &proc_res);
|
||||
}
|
||||
if self.props.should_ice {
|
||||
match proc_res.status.code() {
|
||||
Some(101) => (),
|
||||
_ => self.fatal("expected ICE"),
|
||||
}
|
||||
}
|
||||
|
||||
self.check_forbid_output(&output_to_check, &proc_res);
|
||||
}
|
||||
|
@ -1402,9 +1408,9 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_no_compiler_crash(&self, proc_res: &ProcRes) {
|
||||
fn check_no_compiler_crash(&self, proc_res: &ProcRes, should_ice: bool) {
|
||||
match proc_res.status.code() {
|
||||
Some(101) => self.fatal_proc_rec("compiler encountered internal error", proc_res),
|
||||
Some(101) if !should_ice => self.fatal_proc_rec("compiler encountered internal error", proc_res),
|
||||
None => self.fatal_proc_rec("compiler terminated by signal", proc_res),
|
||||
_ => (),
|
||||
}
|
||||
|
@ -2518,7 +2524,7 @@ impl<'test> TestCx<'test> {
|
|||
self.fatal_proc_rec("compilation failed!", &proc_res);
|
||||
}
|
||||
|
||||
self.check_no_compiler_crash(&proc_res);
|
||||
self.check_no_compiler_crash(&proc_res, self.props.should_ice);
|
||||
|
||||
const PREFIX: &'static str = "MONO_ITEM ";
|
||||
const CGU_MARKER: &'static str = "@@";
|
||||
|
|
Loading…
Add table
Reference in a new issue