summaryrefslogtreecommitdiff
path: root/src/bootstrap/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/test.rs')
-rw-r--r--src/bootstrap/test.rs59
1 files changed, 47 insertions, 12 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index aee84e9c9be..2d600704e02 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -10,6 +10,8 @@ use std::iter;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
+use clap_complete::shells;
+
use crate::builder::crate_description;
use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
use crate::cache::Interned;
@@ -263,7 +265,7 @@ impl Step for Cargotest {
builder,
cmd.arg(&cargo)
.arg(&out_dir)
- .args(builder.config.cmd.test_args())
+ .args(builder.config.test_args())
.env("RUSTC", builder.rustc(compiler))
.env("RUSTDOC", builder.rustdoc(compiler)),
);
@@ -613,6 +615,21 @@ impl Step for Miri {
builder.run(&mut cargo);
}
+ // Run it again for mir-opt-level 4 to catch some miscompilations.
+ if builder.config.test_args().is_empty() {
+ cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
+ // Optimizations can change backtraces
+ cargo.env("MIRI_SKIP_UI_CHECKS", "1");
+ // Optimizations can change error locations and remove UB so don't run `fail` tests.
+ cargo.args(&["tests/pass", "tests/panic"]);
+
+ let mut cargo = prepare_cargo_test(cargo, &[], &[], "miri", compiler, target, builder);
+ {
+ let _time = util::timeit(&builder);
+ builder.run(&mut cargo);
+ }
+ }
+
// # Run `cargo miri test`.
// This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
// that we get the desired output), but that is sufficient to make sure that the libtest harness
@@ -634,7 +651,7 @@ impl Step for Miri {
.arg(builder.src.join("src/tools/miri/test-cargo-miri/Cargo.toml"));
cargo.arg("--target").arg(target.rustc_target_arg());
cargo.arg("--tests"); // don't run doctests, they are too confused by the staging
- cargo.arg("--").args(builder.config.cmd.test_args());
+ cargo.arg("--").args(builder.config.test_args());
// Tell `cargo miri` where to find things.
cargo.env("MIRI_SYSROOT", &miri_sysroot);
@@ -644,8 +661,10 @@ impl Step for Miri {
cargo.env("RUST_BACKTRACE", "1");
let mut cargo = Command::from(cargo);
- let _time = util::timeit(&builder);
- builder.run(&mut cargo);
+ {
+ let _time = util::timeit(&builder);
+ builder.run(&mut cargo);
+ }
}
}
@@ -1060,7 +1079,7 @@ impl Step for RustdocGUI {
}
}
}
- for test_arg in builder.config.cmd.test_args() {
+ for test_arg in builder.config.test_args() {
command.arg(test_arg);
}
builder.run(&mut command);
@@ -1121,7 +1140,24 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
builder.info("tidy check");
try_run(builder, &mut cmd);
- builder.ensure(ExpandYamlAnchors {});
+ builder.ensure(ExpandYamlAnchors);
+
+ builder.info("x.py completions check");
+ let [bash, fish, powershell] = ["x.py.sh", "x.py.fish", "x.py.ps1"]
+ .map(|filename| builder.src.join("src/etc/completions").join(filename));
+ if builder.config.cmd.bless() {
+ builder.ensure(crate::run::GenerateCompletions);
+ } else {
+ if crate::flags::get_completion(shells::Bash, &bash).is_some()
+ || crate::flags::get_completion(shells::Fish, &fish).is_some()
+ || crate::flags::get_completion(shells::PowerShell, &powershell).is_some()
+ {
+ eprintln!(
+ "x.py completions were changed; run `x.py run generate-completions` to update them"
+ );
+ crate::detail_exit(1);
+ }
+ }
}
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -1545,7 +1581,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
// Get paths from cmd args
let paths = match &builder.config.cmd {
- Subcommand::Test { ref paths, .. } => &paths[..],
+ Subcommand::Test { .. } => &builder.config.paths[..],
_ => &[],
};
@@ -1555,8 +1591,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
.filter_map(|p| util::is_valid_test_suite_arg(p, suite_path, builder))
.collect();
- test_args.append(&mut builder.config.cmd.test_args());
- test_args.extend(builder.config.free_args.iter().map(|s| s.as_str()));
+ test_args.append(&mut builder.config.test_args());
// On Windows, replace forward slashes in test-args by backslashes
// so the correct filters are passed to libtest
@@ -1962,7 +1997,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
cmd.arg(markdown);
cmd.env("RUSTC_BOOTSTRAP", "1");
- let test_args = builder.config.cmd.test_args().join(" ");
+ let test_args = builder.config.test_args().join(" ");
cmd.arg("--test-args").arg(test_args);
if builder.config.verbose_tests {
@@ -2099,7 +2134,7 @@ fn prepare_cargo_test(
cargo.arg("-p").arg(krate);
}
- cargo.arg("--").args(&builder.config.cmd.test_args()).args(libtest_args);
+ cargo.arg("--").args(&builder.config.test_args()).args(libtest_args);
if !builder.config.verbose_tests {
cargo.arg("--quiet");
}
@@ -2145,7 +2180,7 @@ impl Step for Crate {
const DEFAULT: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- run.crate_or_deps("test")
+ run.crate_or_deps("sysroot")
}
fn make_run(run: RunConfig<'_>) {