Run Miri and mir-opt tests without a target linker
This commit is contained in:
parent
b8c207435c
commit
735a6a4212
@ -46,6 +46,7 @@ pub struct Std {
|
|||||||
/// but we need to use the downloaded copy of std for linking to rustdoc. Allow this to be overriden by `builder.ensure` from other steps.
|
/// but we need to use the downloaded copy of std for linking to rustdoc. Allow this to be overriden by `builder.ensure` from other steps.
|
||||||
force_recompile: bool,
|
force_recompile: bool,
|
||||||
extra_rust_args: &'static [&'static str],
|
extra_rust_args: &'static [&'static str],
|
||||||
|
is_for_mir_opt_tests: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Std {
|
impl Std {
|
||||||
@ -56,6 +57,7 @@ impl Std {
|
|||||||
crates: Default::default(),
|
crates: Default::default(),
|
||||||
force_recompile: false,
|
force_recompile: false,
|
||||||
extra_rust_args: &[],
|
extra_rust_args: &[],
|
||||||
|
is_for_mir_opt_tests: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +68,18 @@ impl Std {
|
|||||||
crates: Default::default(),
|
crates: Default::default(),
|
||||||
force_recompile: true,
|
force_recompile: true,
|
||||||
extra_rust_args: &[],
|
extra_rust_args: &[],
|
||||||
|
is_for_mir_opt_tests: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_for_mir_opt_tests(compiler: Compiler, target: TargetSelection) -> Self {
|
||||||
|
Self {
|
||||||
|
target,
|
||||||
|
compiler,
|
||||||
|
crates: Default::default(),
|
||||||
|
force_recompile: false,
|
||||||
|
extra_rust_args: &[],
|
||||||
|
is_for_mir_opt_tests: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +94,7 @@ impl Std {
|
|||||||
crates: Default::default(),
|
crates: Default::default(),
|
||||||
force_recompile: false,
|
force_recompile: false,
|
||||||
extra_rust_args,
|
extra_rust_args,
|
||||||
|
is_for_mir_opt_tests: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,6 +124,7 @@ impl Step for Std {
|
|||||||
crates,
|
crates,
|
||||||
force_recompile: false,
|
force_recompile: false,
|
||||||
extra_rust_args: &[],
|
extra_rust_args: &[],
|
||||||
|
is_for_mir_opt_tests: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,11 +222,19 @@ impl Step for Std {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "build");
|
let mut cargo = if self.is_for_mir_opt_tests {
|
||||||
std_cargo(builder, target, compiler.stage, &mut cargo);
|
let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "rustc");
|
||||||
for krate in &*self.crates {
|
cargo.arg("-p").arg("std").arg("--crate-type=lib");
|
||||||
cargo.arg("-p").arg(krate);
|
std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||||
}
|
cargo
|
||||||
|
} else {
|
||||||
|
let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "build");
|
||||||
|
std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||||
|
for krate in &*self.crates {
|
||||||
|
cargo.arg("-p").arg(krate);
|
||||||
|
}
|
||||||
|
cargo
|
||||||
|
};
|
||||||
|
|
||||||
// See src/bootstrap/synthetic_targets.rs
|
// See src/bootstrap/synthetic_targets.rs
|
||||||
if target.is_synthetic() {
|
if target.is_synthetic() {
|
||||||
|
@ -1611,7 +1611,12 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
.ensure(dist::DebuggerScripts { sysroot: builder.sysroot(compiler), host: target });
|
.ensure(dist::DebuggerScripts { sysroot: builder.sysroot(compiler), host: target });
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.ensure(compile::Std::new(compiler, target));
|
if suite == "mir-opt" {
|
||||||
|
builder.ensure(compile::Std::new_for_mir_opt_tests(compiler, target));
|
||||||
|
} else {
|
||||||
|
builder.ensure(compile::Std::new(compiler, target));
|
||||||
|
}
|
||||||
|
|
||||||
// ensure that `libproc_macro` is available on the host.
|
// ensure that `libproc_macro` is available on the host.
|
||||||
builder.ensure(compile::Std::new(compiler, compiler.host));
|
builder.ensure(compile::Std::new(compiler, compiler.host));
|
||||||
|
|
||||||
@ -1619,7 +1624,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
builder.ensure(TestHelpers { target: compiler.host });
|
builder.ensure(TestHelpers { target: compiler.host });
|
||||||
|
|
||||||
// As well as the target, except for plain wasm32, which can't build it
|
// As well as the target, except for plain wasm32, which can't build it
|
||||||
if !target.contains("wasm") || target.contains("emscripten") {
|
if suite != "mir-opt" && !target.contains("wasm") && !target.contains("emscripten") {
|
||||||
builder.ensure(TestHelpers { target });
|
builder.ensure(TestHelpers { target });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,9 +62,15 @@ impl Finder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(build: &mut Build) {
|
pub fn check(build: &mut Build) {
|
||||||
let skip_target_sanity =
|
let mut skip_target_sanity =
|
||||||
env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some_and(|s| s == "1" || s == "true");
|
env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some_and(|s| s == "1" || s == "true");
|
||||||
|
|
||||||
|
// Skip target sanity checks when we are doing anything with mir-opt tests or Miri
|
||||||
|
let skipped_paths = [OsStr::new("mir-opt"), OsStr::new("miri")];
|
||||||
|
skip_target_sanity |= build.config.paths.iter().any(|path| {
|
||||||
|
path.components().any(|component| skipped_paths.contains(&component.as_os_str()))
|
||||||
|
});
|
||||||
|
|
||||||
let path = env::var_os("PATH").unwrap_or_default();
|
let path = env::var_os("PATH").unwrap_or_default();
|
||||||
// On Windows, quotes are invalid characters for filename paths, and if
|
// On Windows, quotes are invalid characters for filename paths, and if
|
||||||
// one is present as part of the PATH then that can lead to the system
|
// one is present as part of the PATH then that can lead to the system
|
||||||
|
@ -37,7 +37,6 @@ else
|
|||||||
fi
|
fi
|
||||||
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
|
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
|
||||||
# Also cover some other targets via cross-testing, in particular all tier 1 targets.
|
# Also cover some other targets via cross-testing, in particular all tier 1 targets.
|
||||||
export BOOTSTRAP_SKIP_TARGET_SANITY=1 # we don't need `cc` for these targets
|
|
||||||
case $HOST_TARGET in
|
case $HOST_TARGET in
|
||||||
x86_64-unknown-linux-gnu)
|
x86_64-unknown-linux-gnu)
|
||||||
# Only this branch runs in PR CI.
|
# Only this branch runs in PR CI.
|
||||||
@ -62,4 +61,3 @@ case $HOST_TARGET in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
unset BOOTSTRAP_SKIP_TARGET_SANITY
|
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
// consts in codegen. We also have tests for this that catches the error, see
|
// consts in codegen. We also have tests for this that catches the error, see
|
||||||
// tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
|
// tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
|
||||||
|
|
||||||
// Force generation of optimized mir for functions that do not reach codegen.
|
|
||||||
// compile-flags: --emit mir,link
|
|
||||||
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
|
||||||
struct PrintName<T>(T);
|
struct PrintName<T>(T);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user