Merge from rustc

This commit is contained in:
The Miri Cronjob Bot 2025-04-18 05:01:10 +00:00
commit dc21c77ae6
130 changed files with 1117 additions and 476 deletions

View file

@ -44,6 +44,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"ignore-arm-unknown-linux-gnueabihf",
"ignore-arm-unknown-linux-musleabi",
"ignore-arm-unknown-linux-musleabihf",
"ignore-auxiliary",
"ignore-avr",
"ignore-beta",
"ignore-cdb",

View file

@ -100,6 +100,10 @@ fn parse_cfg_name_directive<'a>(
name: "test",
message: "always"
}
condition! {
name: "auxiliary",
message: "used by another main test file"
}
condition! {
name: &config.target,
allowed_names: &target_cfgs.all_targets,

View file

@ -940,3 +940,9 @@ fn test_supported_crate_types() {
"//@ needs-crate-type: bin, cdylib, dylib, lib, proc-macro, rlib, staticlib"
));
}
#[test]
fn test_ignore_auxiliary() {
let config = cfg().build();
assert!(check_ignore(&config, "//@ ignore-auxiliary"));
}

View file

@ -9,6 +9,7 @@ use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::sync::Arc;
use std::{env, iter, str};
use build_helper::fs::remove_and_create_dir_all;
use camino::{Utf8Path, Utf8PathBuf};
use colored::Colorize;
use regex::{Captures, Regex};
@ -207,12 +208,6 @@ pub fn compute_stamp_hash(config: &Config) -> String {
format!("{:x}", hash.finish())
}
fn remove_and_create_dir_all(path: &Utf8Path) {
let path = path.as_std_path();
let _ = fs::remove_dir_all(path);
fs::create_dir_all(path).unwrap();
}
#[derive(Copy, Clone, Debug)]
struct TestCx<'test> {
config: &'test Config,
@ -523,7 +518,9 @@ impl<'test> TestCx<'test> {
let mut rustc = Command::new(&self.config.rustc_path);
let out_dir = self.output_base_name().with_extension("pretty-out");
remove_and_create_dir_all(&out_dir);
remove_and_create_dir_all(&out_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{out_dir}`: {e}")
});
let target = if self.props.force_host { &*self.config.host } else { &*self.config.target };
@ -1098,13 +1095,19 @@ impl<'test> TestCx<'test> {
let aux_dir = self.aux_output_dir_name();
if !self.props.aux.builds.is_empty() {
remove_and_create_dir_all(&aux_dir);
remove_and_create_dir_all(&aux_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{aux_dir}`: {e}")
});
}
if !self.props.aux.bins.is_empty() {
let aux_bin_dir = self.aux_bin_output_dir_name();
remove_and_create_dir_all(&aux_dir);
remove_and_create_dir_all(&aux_bin_dir);
remove_and_create_dir_all(&aux_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{aux_dir}`: {e}")
});
remove_and_create_dir_all(&aux_bin_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{aux_bin_dir}`: {e}")
});
}
aux_dir
@ -1509,7 +1512,9 @@ impl<'test> TestCx<'test> {
let set_mir_dump_dir = |rustc: &mut Command| {
let mir_dump_dir = self.get_mir_dump_dir();
remove_and_create_dir_all(&mir_dump_dir);
remove_and_create_dir_all(&mir_dump_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{mir_dump_dir}`: {e}")
});
let mut dir_opt = "-Zdump-mir-dir=".to_string();
dir_opt.push_str(mir_dump_dir.as_str());
debug!("dir_opt: {:?}", dir_opt);
@ -1969,7 +1974,9 @@ impl<'test> TestCx<'test> {
let suffix =
self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly");
let compare_dir = output_base_dir(self.config, self.testpaths, Some(&suffix));
remove_and_create_dir_all(&compare_dir);
remove_and_create_dir_all(&compare_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{compare_dir}`: {e}")
});
// We need to create a new struct for the lifetimes on `config` to work.
let new_rustdoc = TestCx {

View file

@ -7,7 +7,9 @@ impl TestCx<'_> {
assert!(self.revision.is_none(), "revisions not relevant here");
let out_dir = self.output_base_dir();
remove_and_create_dir_all(&out_dir);
remove_and_create_dir_all(&out_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{out_dir}`: {e}")
});
let proc_res = self.document(&out_dir, &self.testpaths);
if !proc_res.status.success() {

View file

@ -9,7 +9,9 @@ impl TestCx<'_> {
assert!(self.revision.is_none(), "revisions not relevant here");
let out_dir = self.output_base_dir();
remove_and_create_dir_all(&out_dir);
remove_and_create_dir_all(&out_dir).unwrap_or_else(|e| {
panic!("failed to remove and recreate output directory `{out_dir}`: {e}")
});
let proc_res = self.document(&out_dir, &self.testpaths);
if !proc_res.status.success() {

View file

@ -13,7 +13,7 @@ pub fn main() {
TLS.set(Some(Box::leak(Box::new(123))));
// We can only ignore leaks on targets that use `#[thread_local]` statics to implement
// `thread_local!`. Ignore the test on targest that don't.
// `thread_local!`. Ignore the test on targets that don't.
if cfg!(target_thread_local) {
thread_local! {
static TLS_KEY: Cell<Option<&'static i32>> = Cell::new(None);

View file

@ -25,6 +25,7 @@ pub struct Environment {
prebuilt_rustc_perf: Option<Utf8PathBuf>,
use_bolt: bool,
shared_llvm: bool,
run_tests: bool,
}
impl Environment {
@ -101,6 +102,10 @@ impl Environment {
pub fn benchmark_cargo_config(&self) -> &[String] {
&self.benchmark_cargo_config
}
pub fn run_tests(&self) -> bool {
self.run_tests
}
}
/// What is the extension of binary executables on this platform?

View file

@ -94,6 +94,10 @@ enum EnvironmentCmd {
/// Arguments passed to `rustc-perf --cargo-config <value>` when running benchmarks.
#[arg(long)]
benchmark_cargo_config: Vec<String>,
/// Perform tests after final build if it's not a try build
#[arg(long)]
run_tests: bool,
},
/// Perform an optimized build on Linux CI, from inside Docker.
LinuxCi {
@ -125,6 +129,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
skipped_tests,
benchmark_cargo_config,
shared,
run_tests,
} => {
let env = EnvironmentBuilder::default()
.host_tuple(target_triple)
@ -138,6 +143,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
.use_bolt(use_bolt)
.skipped_tests(skipped_tests)
.benchmark_cargo_config(benchmark_cargo_config)
.run_tests(run_tests)
.build()?;
(env, shared.build_args)
@ -160,6 +166,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
// FIXME: Enable bolt for aarch64 once it's fixed upstream. Broken as of December 2024.
.use_bolt(!is_aarch64)
.skipped_tests(vec![])
.run_tests(true)
.build()?;
(env, shared.build_args)
@ -179,6 +186,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
.shared_llvm(false)
.use_bolt(false)
.skipped_tests(vec![])
.run_tests(true)
.build()?;
(env, shared.build_args)
@ -344,7 +352,7 @@ fn execute_pipeline(
// possible regressions.
// The tests are not executed for try builds, which can be in various broken states, so we don't
// want to gatekeep them with tests.
if !is_try_build() {
if !is_try_build() && env.run_tests() {
timer.section("Run tests", |_| run_tests(env))?;
}

View file

@ -14,9 +14,5 @@ build_helper = { path = "../../build_helper" }
serde_json = "1.0"
libc = "0.2"
# FIXME(#137532): replace `os_pipe` with `anonymous_pipe` once it stabilizes and
# reaches beta.
os_pipe = "1.2.1"
[lib]
crate-type = ["lib", "dylib"]

View file

@ -41,8 +41,6 @@ pub use bstr;
pub use gimli;
pub use libc;
pub use object;
// FIXME(#137532): replace with std `anonymous_pipe` once it stabilizes and reaches beta.
pub use os_pipe;
pub use regex;
pub use serde_json;
pub use similar;

View file

@ -902,9 +902,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.169"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "libloading"

View file

@ -260,7 +260,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"constant_time_eq",
"cpufeatures",
"crc32fast",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-utils",
@ -295,7 +294,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"gimli",
"gsgdt",
"hashbrown",
"hermit-abi",
"icu_list",
"icu_list_data",
"icu_locid",
@ -329,7 +327,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"miniz_oxide",
"nix",
"nu-ansi-term",
"num_cpus",
"object",
"odht",
"once_cell",