Skip to content

Commit 874103b

Browse files
committed
bootstrap: split run-make into {run-make,run-make-cargo} test suites
So that contributors who don't need to run `run-make` tests that require in-tree `cargo` can run the non-cargo `run-make` tests without having to wait for `cargo` (which would require rebuilding as the build cache would be invalidated by compiler modifications without some kind of `--keep-stage-cargo`).
1 parent 91edc3e commit 874103b

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,12 @@ test!(Pretty {
15221522
});
15231523

15241524
test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make", default: true });
1525+
test!(RunMakeCargo {
1526+
path: "tests/run-make-cargo",
1527+
mode: "run-make",
1528+
suite: "run-make-cargo",
1529+
default: true
1530+
});
15251531

15261532
test!(AssemblyLlvm {
15271533
path: "tests/assembly-llvm",
@@ -1816,25 +1822,41 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
18161822

18171823
let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js";
18181824

1825+
// There are (potentially) 2 `cargo`s to consider:
1826+
//
1827+
// - A "bootstrap" cargo, which is the same cargo used to build bootstrap itself, and is
1828+
// used to build the `run-make` test recipes and the `run-make-support` test library. All
1829+
// of these may not use unstable rustc/cargo features.
1830+
// - An in-tree cargo, which should be considered as under test. The `run-make-cargo` test
1831+
// suite is intended to support the use case of testing the "toolchain" (that is, at the
1832+
// minimum the interaction between in-tree cargo + rustc) together.
1833+
//
1834+
// For build time and iteration purposes, we partition `run-make` tests which needs an
1835+
// in-tree cargo (a smaller subset) versus `run-make` tests that do not into two test
1836+
// suites, `run-make` and `run-make-cargo`. That way, contributors who do not need to run
1837+
// the `run-make` tests that need in-tree cargo do not need to spend time building in-tree
1838+
// cargo.
18191839
if mode == "run-make" {
1820-
let cargo_path = if test_compiler.stage == 0 {
1821-
// If we're using `--stage 0`, we should provide the bootstrap cargo.
1822-
builder.initial_cargo.clone()
1823-
} else {
1824-
builder
1825-
.ensure(tool::Cargo::from_build_compiler(
1826-
builder.compiler(test_compiler.stage - 1, test_compiler.host),
1827-
test_compiler.host,
1828-
))
1829-
.tool_path
1830-
};
1831-
1832-
cmd.arg("--cargo-path").arg(cargo_path);
1833-
18341840
// We need to pass the compiler that was used to compile run-make-support,
18351841
// because we have to use the same compiler to compile rmake.rs recipes.
18361842
let stage0_rustc_path = builder.compiler(0, test_compiler.host);
18371843
cmd.arg("--stage0-rustc-path").arg(builder.rustc(stage0_rustc_path));
1844+
1845+
if suite == "run-make-cargo" {
1846+
let cargo_path = if test_compiler.stage == 0 {
1847+
// If we're using `--stage 0`, we should provide the bootstrap cargo.
1848+
builder.initial_cargo.clone()
1849+
} else {
1850+
builder
1851+
.ensure(tool::Cargo::from_build_compiler(
1852+
builder.compiler(test_compiler.stage - 1, test_compiler.host),
1853+
test_compiler.host,
1854+
))
1855+
.tool_path
1856+
};
1857+
1858+
cmd.arg("--cargo-path").arg(cargo_path);
1859+
}
18381860
}
18391861

18401862
// Avoid depending on rustdoc when we don't need it.

src/bootstrap/src/core/builder/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
444444
"tests/mir-opt",
445445
"tests/pretty",
446446
"tests/run-make",
447+
"tests/run-make-cargo",
447448
"tests/rustdoc",
448449
"tests/rustdoc-gui",
449450
"tests/rustdoc-js",
@@ -1127,8 +1128,8 @@ impl<'a> Builder<'a> {
11271128
test::RustInstaller,
11281129
test::TestFloatParse,
11291130
test::CollectLicenseMetadata,
1130-
// Run run-make last, since these won't pass without make on Windows
11311131
test::RunMake,
1132+
test::RunMakeCargo,
11321133
),
11331134
Kind::Miri => describe!(test::Crate),
11341135
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),

0 commit comments

Comments
 (0)