diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 965d11621450b..94295ece62568 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -167,9 +167,9 @@ impl Step for Cargotest { /// This tool in `src/tools` will check out a few Rust projects and run `cargo /// test` to ensure that we don't regress the test suites there. fn run(self, builder: &Builder<'_>) { - let compiler = builder.compiler(self.stage, self.host); - builder.ensure(compile::Rustc { compiler, target: compiler.host }); - let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host }); + let bootstrap_compiler = builder.compiler(0, self.host); + let cargo = builder + .ensure(tool::Cargo { compiler: bootstrap_compiler, target: bootstrap_compiler.host }); // Note that this is a short, cryptic, and not scoped directory name. This // is currently to minimize the length of path on Windows where we otherwise @@ -179,12 +179,14 @@ impl Step for Cargotest { let _time = util::timeit(&builder); let mut cmd = builder.tool_cmd(Tool::CargoTest); + let test_compiler = builder.compiler(self.stage, self.host); try_run( builder, cmd.arg(&cargo) .arg(&out_dir) - .env("RUSTC", builder.rustc(compiler)) - .env("RUSTDOC", builder.rustdoc(compiler)), + .args(builder.config.cmd.test_args()) + .env("RUSTC", builder.rustc(test_compiler)) + .env("RUSTDOC", builder.rustdoc(test_compiler)), ); } } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index e85f4628fb03a..c90022b3e2514 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -595,7 +595,7 @@ impl Step for Cargo { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Cargo { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build), + compiler: run.builder.compiler(0, run.builder.config.build), target: run.target, }); } @@ -606,7 +606,7 @@ impl Step for Cargo { compiler: self.compiler, target: self.target, tool: "cargo", - mode: Mode::ToolRustc, + mode: Mode::ToolBootstrap, path: "src/tools/cargo", is_optional_tool: false, source_type: SourceType::Submodule, @@ -621,7 +621,7 @@ impl Step for Cargo { compiler: self.compiler, target: self.target, tool: name, - mode: Mode::ToolRustc, + mode: Mode::ToolBootstrap, path, is_optional_tool: true, source_type: SourceType::Submodule, diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index fc608eaabccf7..54ff38e39dbe4 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -85,7 +85,9 @@ fn main() { let cargo = &Path::new(cargo); for test in TEST_REPOS.iter().rev() { - test_repo(cargo, out_dir, test); + if args[3..].is_empty() || args[3..].iter().any(|s| s.contains(test.name)) { + test_repo(cargo, out_dir, test); + } } }