Skip to content

Commit 1629b81

Browse files
Auto merge of #146233 - jieyouxu:run-make-fission, r=<try>
[EXPERIMENTAL] `run-make` fission try-job: aarch64-msvc-1 try-job: test-various try-job: x86_64-gnu-debug try-job: aarch64-gnu-debug try-job: aarch64-apple try-job: dist-various-1
2 parents ad85bc5 + 4b9dbe3 commit 1629b81

File tree

70 files changed

+115
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+115
-68
lines changed

compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
121121
# ============================================================
122122
rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
123123
rm -r tests/run-make/strip # same
124-
rm -r tests/run-make/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source
124+
rm -r tests/run-make-cargo/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source
125125
rm -r tests/run-make/translation # same
126126
rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features
127127
rm -r tests/run-make/const-trait-stable-toolchain # same

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),

src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ ENV RUST_CONFIGURE_ARGS \
5454

5555
ENV SCRIPT \
5656
python3 ../x.py --stage 2 build && \
57-
python3 ../x.py --stage 2 test tests/run-make
57+
python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo

src/ci/docker/host-x86_64/dist-various-1/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ENV RUST_CONFIGURE_ARGS \
158158
--disable-docs
159159

160160
ENV SCRIPT \
161-
python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make && \
161+
python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make tests/run-make-cargo && \
162162
python3 ../x.py dist --host='' --target $TARGETS
163163

164164
# sccache

src/ci/docker/host-x86_64/test-various/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0
6060
tar -xJ
6161
ENV PATH "$PATH:/wasmtime-v19.0.0-x86_64-linux"
6262

63-
ENV WASM_WASIP_TARGET=wasm32-wasip1
63+
ENV WASM_WASIP_TARGET=wasm32-wasip1
6464
ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_WASIP_TARGET \
6565
tests/run-make \
66+
tests/run-make-cargo \
6667
tests/ui \
6768
tests/mir-opt \
6869
tests/codegen-units \
@@ -73,6 +74,7 @@ ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $
7374
ENV NVPTX_TARGETS=nvptx64-nvidia-cuda
7475
ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \
7576
tests/run-make \
77+
tests/run-make-cargo \
7678
tests/assembly-llvm
7779

7880
ENV MUSL_TARGETS=x86_64-unknown-linux-musl \
@@ -88,8 +90,8 @@ ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \
8890
CC_x86_64_unknown_uefi=clang-11 \
8991
CXX_x86_64_unknown_uefi=clang++-11
9092
ENV UEFI_SCRIPT python3 /checkout/x.py --stage 2 build --host='' --target $UEFI_TARGETS && \
91-
python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \
92-
python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target i686-unknown-uefi && \
93-
python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target x86_64-unknown-uefi
93+
python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \
94+
python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target i686-unknown-uefi && \
95+
python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target x86_64-unknown-uefi
9496

9597
ENV SCRIPT $WASM_WASIP_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT

src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ ENV RUST_CONFIGURE_ARGS \
5656
ENV SCRIPT \
5757
python3 ../x.py --stage 2 build && \
5858
python3 ../x.py --stage 2 test tests/ui && \
59-
python3 ../x.py --stage 2 test tests/run-make
59+
python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo

src/doc/rustc-dev-guide/src/tests/adding.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ guidelines:
2929
suites.
3030
- Need to inspect the resulting binary in some way? Or if all the other test
3131
suites are too limited for your purposes? Then use `run-make`.
32+
- Use `run-make-cargo` if you need to exercise in-tree `cargo` in conjunction
33+
with in-tree `rustc`.
3234
- Check out the [compiletest] chapter for more specialized test suites.
3335

3436
After deciding on which kind of test to add, see [best

src/doc/rustc-dev-guide/src/tests/best-practices.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ related tests.
8383
- E.g. for an implementation of RFC 2093 specifically, we can group a
8484
collection of tests under `tests/ui/rfc-2093-infer-outlives/`. For the
8585
directory name, include what the RFC is about.
86-
- For the [`run-make`] test suite, each `rmake.rs` must be contained within an
87-
immediate subdirectory under `tests/run-make/`. Further nesting is not
88-
presently supported. Avoid including issue number in the directory name too,
89-
include that info in a comment inside `rmake.rs`.
86+
- For the [`run-make`]/`run-make-support` test suites, each `rmake.rs` must
87+
be contained within an immediate subdirectory under `tests/run-make/` or
88+
`tests/run-make-cargo/` respectively. Further nesting is not presently
89+
supported. Avoid using _only_ an issue number for the test name as well.
9090
9191
## Test descriptions
9292

src/doc/rustc-dev-guide/src/tests/compiletest.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,19 @@ your test, causing separate files to be generated for 32bit and 64bit systems.
397397

398398
### `run-make` tests
399399

400-
The tests in [`tests/run-make`] are general-purpose tests using Rust *recipes*,
401-
which are small programs (`rmake.rs`) allowing arbitrary Rust code such as
402-
`rustc` invocations, and is supported by a [`run_make_support`] library. Using
403-
Rust recipes provide the ultimate in flexibility.
400+
The tests in [`tests/run-make`] and [`tests/run-make-cargo`] are general-purpose
401+
tests using Rust *recipes*, which are small programs (`rmake.rs`) allowing
402+
arbitrary Rust code such as `rustc` invocations, and is supported by a
403+
[`run_make_support`] library. Using Rust recipes provide the ultimate in
404+
flexibility.
404405

405406
`run-make` tests should be used if no other test suites better suit your needs.
406407

408+
The `run-make-cargo` test suite additionally builds an in-tree `cargo` to support
409+
use cases that require testing in-tree `cargo` in conjunction with in-tree `rustc`.
410+
The `run-make` test suite does not have access to in-tree `cargo` (so it can be the
411+
faster-to-iterate test suite).
412+
407413
#### Using Rust recipes
408414

409415
Each test should be in a separate directory with a `rmake.rs` Rust program,
@@ -476,6 +482,7 @@ Then add a corresponding entry to `"rust-analyzer.linkedProjects"`
476482
```
477483

478484
[`tests/run-make`]: https://github.com/rust-lang/rust/tree/master/tests/run-make
485+
[`tests/run-make-cargo`]: https://github.com/rust-lang/rust/tree/master/tests/run-make-cargo
479486
[`run_make_support`]: https://github.com/rust-lang/rust/tree/master/src/tools/run-make-support
480487

481488
### Coverage tests

0 commit comments

Comments
 (0)