Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Don't require building a stage1 compiler before running cargotest #84780

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)),
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/tools/cargotest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down