Enforce successful ui tests to have must-compile-successfully flag.
This commit is contained in:
parent
2537a499c2
commit
5990b8b57c
@ -218,7 +218,7 @@ pub struct TestProps {
|
||||
// testing harness and used when generating compilation
|
||||
// arguments. (In particular, it propagates to the aux-builds.)
|
||||
pub incremental_dir: Option<PathBuf>,
|
||||
// Specifies that a cfail test must actually compile without errors.
|
||||
// Specifies that a test must actually compile without errors.
|
||||
pub must_compile_successfully: bool,
|
||||
// rustdoc will test the output of the `--test` option
|
||||
pub check_test_line_numbers_match: bool,
|
||||
|
@ -147,23 +147,26 @@ impl<'test> TestCx<'test> {
|
||||
assert!(self.revision.is_none(), "init_all invoked for a revision");
|
||||
}
|
||||
|
||||
fn run_cfail_test(&self) {
|
||||
let proc_res = self.compile_test();
|
||||
|
||||
fn check_if_test_should_compile(&self, proc_res: &ProcRes) {
|
||||
if self.props.must_compile_successfully {
|
||||
if !proc_res.status.success() {
|
||||
self.fatal_proc_rec("test compilation failed although it shouldn't!", &proc_res);
|
||||
self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res);
|
||||
}
|
||||
} else {
|
||||
if proc_res.status.success() {
|
||||
self.fatal_proc_rec(
|
||||
&format!("{} test compiled successfully!", self.config.mode)[..],
|
||||
&proc_res,
|
||||
proc_res,
|
||||
);
|
||||
}
|
||||
|
||||
self.check_correct_failure_status(&proc_res);
|
||||
self.check_correct_failure_status(proc_res);
|
||||
}
|
||||
}
|
||||
|
||||
fn run_cfail_test(&self) {
|
||||
let proc_res = self.compile_test();
|
||||
self.check_if_test_should_compile(&proc_res);
|
||||
|
||||
let output_to_check = self.get_output(&proc_res);
|
||||
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
|
||||
@ -2388,6 +2391,7 @@ impl<'test> TestCx<'test> {
|
||||
.any(|s| s.contains("--error-format"));
|
||||
|
||||
let proc_res = self.compile_test();
|
||||
self.check_if_test_should_compile(&proc_res);
|
||||
|
||||
let expected_stderr_path = self.expected_output_path(UI_STDERR);
|
||||
let expected_stderr = self.load_expected_output(&expected_stderr_path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user