compiletest: Validate pass modes harder
This commit is contained in:
parent
6203f68735
commit
8e8fba1b3b
11 changed files with 49 additions and 32 deletions
|
@ -2,7 +2,7 @@
|
|||
// rustc_on_unimplemented, but with this bug we are seeing it fire (on
|
||||
// subsequent runs) if incremental compilation is enabled.
|
||||
|
||||
// revisions: rpass1 rpass2
|
||||
// revisions: cfail1 cfail2
|
||||
// compile-pass
|
||||
|
||||
#![feature(on_unimplemented)]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// seeing it fire (on subsequent runs) if incremental compilation is
|
||||
// enabled.
|
||||
|
||||
// revisions: rpass1 rpass2
|
||||
// revisions: cfail1 cfail2
|
||||
// compile-pass
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-pass
|
||||
// error-pattern:returned Box<dyn Error> from main()
|
||||
// failure-status: 1
|
||||
|
||||
use std::error::Error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-pass
|
||||
// error-pattern:returned Box<Error> from main()
|
||||
// failure-status: 1
|
||||
|
||||
use std::io::{Error, ErrorKind};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// compile-pass
|
||||
// run-pass
|
||||
|
||||
#![feature(const_fn_union)]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// compile-pass
|
||||
// run-pass
|
||||
|
||||
enum Foo {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// skip-codegen
|
||||
// compile-pass
|
||||
// check-pass
|
||||
|
||||
macro_rules! mac {
|
||||
{} => {
|
||||
|
@ -19,5 +18,4 @@ macro_rules! mac {
|
|||
|
||||
mac! {}
|
||||
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// skip-codegen
|
||||
// compile-pass
|
||||
// check-pass
|
||||
|
||||
#![feature(unboxed_closures, fn_traits)]
|
||||
struct Foo;
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
// skip-codegen
|
||||
// compile-pass
|
||||
// check-pass
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
type Z = dyn for<'x> Send;
|
||||
//~^ WARN type alias is never used
|
||||
|
||||
|
||||
fn main() {
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
// compile-pass
|
||||
|
||||
#![deny(single_use_lifetimes)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
// Test that we DO NOT warn when lifetime name is used only
|
||||
// once in a fn return type -- using `'_` is not legal there,
|
||||
// as it must refer back to an argument.
|
||||
//
|
||||
// (Normally, using `'static` would be preferred, but there are
|
||||
// times when that is not what you want.)
|
||||
//
|
||||
// run-pass
|
||||
|
||||
// compile-pass
|
||||
|
||||
#![deny(single_use_lifetimes)]
|
||||
|
||||
fn b<'a>() -> &'a u32 { // OK: used only in return type
|
||||
&22
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
fn main() {}
|
||||
|
|
|
@ -526,14 +526,41 @@ impl TestProps {
|
|||
self.check_test_line_numbers_match = config.parse_check_test_line_numbers_match(ln);
|
||||
}
|
||||
|
||||
if config.parse_name_directive(ln, "check-pass") ||
|
||||
config.parse_name_directive(ln, "skip-codegen") {
|
||||
self.pass_mode = Some(PassMode::Check);
|
||||
} else if config.parse_name_directive(ln, "build-pass") ||
|
||||
config.parse_name_directive(ln, "compile-pass") {
|
||||
self.pass_mode = Some(PassMode::Build);
|
||||
let check_no_run = |s| {
|
||||
if config.mode != Mode::Ui && config.mode != Mode::Incremental {
|
||||
panic!("`{}` header is only supported in UI and incremental tests", s);
|
||||
}
|
||||
if config.mode == Mode::Incremental &&
|
||||
!cfg.map_or(false, |r| r.starts_with("cfail")) &&
|
||||
!self.revisions.iter().all(|r| r.starts_with("cfail")) {
|
||||
panic!("`{}` header is only supported in `cfail` incremental tests", s);
|
||||
}
|
||||
};
|
||||
let pass_mode = if config.parse_name_directive(ln, "check-pass") {
|
||||
check_no_run("check-pass");
|
||||
Some(PassMode::Check)
|
||||
} else if config.parse_name_directive(ln, "skip-codegen") {
|
||||
check_no_run("skip-codegen");
|
||||
Some(PassMode::Check)
|
||||
} else if config.parse_name_directive(ln, "build-pass") {
|
||||
check_no_run("build-pass");
|
||||
Some(PassMode::Build)
|
||||
} else if config.parse_name_directive(ln, "compile-pass") {
|
||||
check_no_run("compile-pass");
|
||||
Some(PassMode::Build)
|
||||
} else if config.parse_name_directive(ln, "run-pass") {
|
||||
self.pass_mode = Some(PassMode::Run);
|
||||
if config.mode != Mode::Ui && config.mode != Mode::RunPass /* compatibility */ {
|
||||
panic!("`run-pass` header is only supported in UI tests")
|
||||
}
|
||||
Some(PassMode::Run)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
match (self.pass_mode, pass_mode) {
|
||||
(None, Some(_)) => self.pass_mode = pass_mode,
|
||||
(Some(_), Some(pm)) if pm == PassMode::Check => self.pass_mode = pass_mode,
|
||||
(Some(_), Some(_)) => panic!("multiple `*-pass` headers in a single test"),
|
||||
(_, None) => {}
|
||||
}
|
||||
|
||||
if !self.disable_ui_testing_normalization {
|
||||
|
|
Loading…
Add table
Reference in a new issue