mirror of
https://github.com/rust-lang/cargo
synced 2024-10-02 14:04:23 +00:00
test(rustfix): run some tests only on nightly
This commit is contained in:
parent
1fec089991
commit
26bcf58bfe
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2938,7 +2938,7 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|||
|
||||
[[package]]
|
||||
name = "rustfix"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"proptest",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "rustfix"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
authors = [
|
||||
"Pascal Hertleif <killercup@gmail.com>",
|
||||
"Oliver Schneider <oli-obk@users.noreply.github.com>",
|
||||
|
|
|
@ -45,6 +45,26 @@ mod settings {
|
|||
pub const BLESS: &str = "RUSTFIX_TEST_BLESS";
|
||||
}
|
||||
|
||||
static mut VERSION: (u32, bool) = (0, false);
|
||||
|
||||
// Temporarily copy from `cargo_test_macro::version`.
|
||||
fn version() -> (u32, bool) {
|
||||
static INIT: std::sync::Once = std::sync::Once::new();
|
||||
INIT.call_once(|| {
|
||||
let output = Command::new("rustc")
|
||||
.arg("-V")
|
||||
.output()
|
||||
.expect("cargo should run");
|
||||
let stdout = std::str::from_utf8(&output.stdout).expect("utf8");
|
||||
let vers = stdout.split_whitespace().skip(1).next().unwrap();
|
||||
let is_nightly = option_env!("CARGO_TEST_DISABLE_NIGHTLY").is_none()
|
||||
&& (vers.contains("-nightly") || vers.contains("-dev"));
|
||||
let minor = vers.split('.').skip(1).next().unwrap().parse().unwrap();
|
||||
unsafe { VERSION = (minor, is_nightly) }
|
||||
});
|
||||
unsafe { VERSION }
|
||||
}
|
||||
|
||||
fn compile(file: &Path) -> Result<Output, Error> {
|
||||
let tmp = tempdir()?;
|
||||
|
||||
|
@ -220,7 +240,20 @@ fn assert_fixtures(dir: &str, mode: &str) {
|
|||
.unwrap();
|
||||
let mut failures = 0;
|
||||
|
||||
let is_not_nightly = !version().1;
|
||||
|
||||
for file in &files {
|
||||
if file
|
||||
.file_stem()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.ends_with(".nightly")
|
||||
&& is_not_nightly
|
||||
{
|
||||
info!("skipped: {file:?}");
|
||||
continue;
|
||||
}
|
||||
if let Err(err) = test_rustfix_with_file(file, mode) {
|
||||
println!("failed: {}", file.display());
|
||||
warn!("{:?}", err);
|
||||
|
|
Loading…
Reference in a new issue