mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 10:24:16 +00:00
Allow tests to be run on nightly only
This commit is contained in:
parent
c97aa152da
commit
fd22c27c47
@ -259,9 +259,9 @@ fn assert_output(source: &Path, expected_filename: &Path) {
|
||||
#[test]
|
||||
fn idempotence_tests() {
|
||||
run_test_with(&TestSetting::default(), || {
|
||||
match option_env!("CFG_RELEASE_CHANNEL") {
|
||||
None | Some("nightly") => {}
|
||||
_ => return, // these tests require nightly
|
||||
// these tests require nightly
|
||||
if !is_nightly() {
|
||||
return;
|
||||
}
|
||||
// Get all files in the tests/target directory.
|
||||
let files = get_test_files(Path::new("tests/target"), true);
|
||||
@ -277,9 +277,9 @@ fn idempotence_tests() {
|
||||
// no warnings are emitted.
|
||||
#[test]
|
||||
fn self_tests() {
|
||||
match option_env!("CFG_RELEASE_CHANNEL") {
|
||||
None | Some("nightly") => {}
|
||||
_ => return, // Issue-3443: these tests require nightly
|
||||
// Issue-3443: these tests require nightly
|
||||
if !is_nightly() {
|
||||
return;
|
||||
}
|
||||
let mut files = get_test_files(Path::new("tests"), false);
|
||||
let bin_directories = vec!["cargo-fmt", "git-rustfmt", "bin", "format-diff"];
|
||||
@ -313,6 +313,11 @@ fn self_tests() {
|
||||
);
|
||||
}
|
||||
|
||||
fn is_nightly() -> bool {
|
||||
let release_channel = option_env!("CFG_RELEASE_CHANNEL");
|
||||
release_channel.is_none() || release_channel == Some("nightly")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stdin_formatting_smoke_test() {
|
||||
let input = Input::Text("fn main () {}".to_owned());
|
||||
@ -426,6 +431,16 @@ fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<Format
|
||||
let mut reports = vec![];
|
||||
|
||||
for file_name in files {
|
||||
let sig_comments = read_significant_comments(&file_name);
|
||||
if sig_comments.contains_key("unstable") && !is_nightly() {
|
||||
debug!(
|
||||
"Skipping '{}' because it requires unstable \
|
||||
features which are only available on nightly...",
|
||||
file_name.display()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
debug!("Testing '{}'...", file_name.display());
|
||||
|
||||
match idempotent_check(&file_name, &opt_config) {
|
||||
@ -485,7 +500,7 @@ fn read_config(filename: &Path) -> Config {
|
||||
};
|
||||
|
||||
for (key, val) in &sig_comments {
|
||||
if key != "target" && key != "config" {
|
||||
if key != "target" && key != "config" && key != "unstable" {
|
||||
config.override_value(key, val);
|
||||
if config.is_default(key) {
|
||||
warn!("Default value {} used explicitly for {}", val, key);
|
||||
|
Loading…
Reference in New Issue
Block a user