提交 6299c330 编写于 作者: Q Quentin Boyer

add header to compiletest to check for ice

上级 5930551f
......@@ -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 @@ pub fn new() -> Self {
run_rustfix: false,
rustfix_only_machine_applicable: false,
assembly_output: None,
should_ice: false,
}
}
......@@ -464,6 +467,10 @@ fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) {
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 @@ fn check_if_test_should_compile(&self, proc_res: &ProcRes) {
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 @@ fn run_cfail_test(&self) {
} 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 @@ fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) {
}
}
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 @@ fn run_codegen_units_test(&self) {
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 = "@@";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册