Special case error message for a build-fail
test that failed check build
This commit is contained in:
parent
ecf2d1fa4b
commit
40ca4d8cd3
@ -318,10 +318,29 @@ fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_if_test_should_compile(&self, proc_res: &ProcRes, pm: Option<PassMode>) {
|
fn check_if_test_should_compile(
|
||||||
if self.should_compile_successfully(pm) {
|
&self,
|
||||||
|
fail_mode: Option<FailMode>,
|
||||||
|
pass_mode: Option<PassMode>,
|
||||||
|
proc_res: &ProcRes,
|
||||||
|
) {
|
||||||
|
if self.should_compile_successfully(pass_mode) {
|
||||||
if !proc_res.status.success() {
|
if !proc_res.status.success() {
|
||||||
self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res);
|
match (fail_mode, pass_mode) {
|
||||||
|
(Some(FailMode::Build), Some(PassMode::Check)) => {
|
||||||
|
// A `build-fail` test needs to `check-pass`.
|
||||||
|
self.fatal_proc_rec(
|
||||||
|
"`build-fail` test is required to pass check build, but check build failed",
|
||||||
|
proc_res,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
self.fatal_proc_rec(
|
||||||
|
"test compilation failed although it shouldn't!",
|
||||||
|
proc_res,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if proc_res.status.success() {
|
if proc_res.status.success() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::{TestCx, WillExecute};
|
use super::{FailMode, TestCx, WillExecute};
|
||||||
use crate::errors;
|
use crate::errors;
|
||||||
|
|
||||||
impl TestCx<'_> {
|
impl TestCx<'_> {
|
||||||
@ -96,7 +96,7 @@ fn run_rpass_test(&self) {
|
|||||||
fn run_cfail_test(&self) {
|
fn run_cfail_test(&self) {
|
||||||
let pm = self.pass_mode();
|
let pm = self.pass_mode();
|
||||||
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
|
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
|
||||||
self.check_if_test_should_compile(&proc_res, pm);
|
self.check_if_test_should_compile(Some(FailMode::Build), pm, &proc_res);
|
||||||
self.check_no_compiler_crash(&proc_res, self.props.should_ice);
|
self.check_no_compiler_crash(&proc_res, self.props.should_ice);
|
||||||
|
|
||||||
let output_to_check = self.get_output(&proc_res);
|
let output_to_check = self.get_output(&proc_res);
|
||||||
|
@ -18,14 +18,14 @@ pub(super) fn run_ui_test(&self) {
|
|||||||
let pm = Some(PassMode::Check);
|
let pm = Some(PassMode::Check);
|
||||||
let proc_res =
|
let proc_res =
|
||||||
self.compile_test_general(WillExecute::No, Emit::Metadata, pm, Vec::new());
|
self.compile_test_general(WillExecute::No, Emit::Metadata, pm, Vec::new());
|
||||||
self.check_if_test_should_compile(&proc_res, pm);
|
self.check_if_test_should_compile(self.props.fail_mode, pm, &proc_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
let pm = self.pass_mode();
|
let pm = self.pass_mode();
|
||||||
let should_run = self.should_run(pm);
|
let should_run = self.should_run(pm);
|
||||||
let emit_metadata = self.should_emit_metadata(pm);
|
let emit_metadata = self.should_emit_metadata(pm);
|
||||||
let proc_res = self.compile_test(should_run, emit_metadata);
|
let proc_res = self.compile_test(should_run, emit_metadata);
|
||||||
self.check_if_test_should_compile(&proc_res, pm);
|
self.check_if_test_should_compile(self.props.fail_mode, pm, &proc_res);
|
||||||
if matches!(proc_res.truncated, Truncated::Yes)
|
if matches!(proc_res.truncated, Truncated::Yes)
|
||||||
&& !self.props.dont_check_compiler_stdout
|
&& !self.props.dont_check_compiler_stdout
|
||||||
&& !self.props.dont_check_compiler_stderr
|
&& !self.props.dont_check_compiler_stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user