Skip to content

Commit 5990b8b

Browse files
committed
Enforce successful ui tests to have must-compile-successfully flag.
1 parent 2537a49 commit 5990b8b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub struct TestProps {
218218
// testing harness and used when generating compilation
219219
// arguments. (In particular, it propagates to the aux-builds.)
220220
pub incremental_dir: Option<PathBuf>,
221-
// Specifies that a cfail test must actually compile without errors.
221+
// Specifies that a test must actually compile without errors.
222222
pub must_compile_successfully: bool,
223223
// rustdoc will test the output of the `--test` option
224224
pub check_test_line_numbers_match: bool,

src/tools/compiletest/src/runtest.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,26 @@ impl<'test> TestCx<'test> {
147147
assert!(self.revision.is_none(), "init_all invoked for a revision");
148148
}
149149

150-
fn run_cfail_test(&self) {
151-
let proc_res = self.compile_test();
152-
150+
fn check_if_test_should_compile(&self, proc_res: &ProcRes) {
153151
if self.props.must_compile_successfully {
154152
if !proc_res.status.success() {
155-
self.fatal_proc_rec("test compilation failed although it shouldn't!", &proc_res);
153+
self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res);
156154
}
157155
} else {
158156
if proc_res.status.success() {
159157
self.fatal_proc_rec(
160158
&format!("{} test compiled successfully!", self.config.mode)[..],
161-
&proc_res,
159+
proc_res,
162160
);
163161
}
164162

165-
self.check_correct_failure_status(&proc_res);
163+
self.check_correct_failure_status(proc_res);
166164
}
165+
}
166+
167+
fn run_cfail_test(&self) {
168+
let proc_res = self.compile_test();
169+
self.check_if_test_should_compile(&proc_res);
167170

168171
let output_to_check = self.get_output(&proc_res);
169172
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
@@ -2388,6 +2391,7 @@ impl<'test> TestCx<'test> {
23882391
.any(|s| s.contains("--error-format"));
23892392

23902393
let proc_res = self.compile_test();
2394+
self.check_if_test_should_compile(&proc_res);
23912395

23922396
let expected_stderr_path = self.expected_output_path(UI_STDERR);
23932397
let expected_stderr = self.load_expected_output(&expected_stderr_path);

0 commit comments

Comments
 (0)