Skip to content

Commit 1a9f1c2

Browse files
committed
Auto merge of #146233 - jieyouxu:run-make-fission, r=Kobzol
Split `run-make` into two {`run-make`,`run-make-cargo`} test suites ## Summary Split `tests/run-make` into two test suites, to make it faster and more convenient for contributors to run run-make tests that do not need in-tree `cargo`. | New test suites | Explanation | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `tests/run-make` | The "fast path" test suite intended for run-make tests that do not need in-tree `cargo`. These tests may not use `cargo`. | | `tests/run-make-cargo` | The "slow path" test suite that requires checking out `cargo` submodule and building in-tree `cargo`, and thus will have access to in-tree `cargo`. In practice, these constitute a very small portion of the original `run-make` tests. | This PR carries out [MCP 847: Split run-make test suite into slower-building test suite with suitably-staged cargo and faster-building test suite without cargo](rust-lang/compiler-team#847). Fixes rust-lang/rust#135573 (for the tests that do not need in-tree `cargo`). Fixes rust-lang/rust#134109. ## Remarks - I considered if we want to split by in-tree tools previously. However, as discussed rust-lang/rust#134109, in practice `rustdoc` is not very slow to build, but `cargo` takes a good few minutes. So, the partition boundary was determined to be along in-tree `cargo` availability. - The `run-make` tests previously that wanted to use `cargo` cannot just use the bootstrap `cargo`, otherwise they would run into situations where bootstrap `cargo` can significantly diverge from in-tree `cargo` (see rust-lang/rust#130642). --- 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 abc08e7 + e85319f commit 1a9f1c2

File tree

5 files changed

+39
-30
lines changed

5 files changed

+39
-30
lines changed

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/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/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

src/tests/directives.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ not be exhaustive. Directives can generally be found by browsing the
5252

5353
See [Building auxiliary crates](compiletest.html#building-auxiliary-crates)
5454

55-
| Directive | Explanation | Supported test suites | Possible values |
56-
|-----------------------|-------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------|
57-
| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make` | Path to auxiliary `.rs` file |
58-
| `aux-build` | Build a separate crate from the named source file | All except `run-make` | Path to auxiliary `.rs` file |
59-
| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make` | `<extern_prelude_name>=<path/to/aux/file.rs>` |
60-
| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file |
61-
| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make` | Path to auxiliary proc-macro `.rs` file |
62-
| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make` | N/A |
55+
| Directive | Explanation | Supported test suites | Possible values |
56+
|-----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------|-----------------------------------------------|
57+
| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
58+
| `aux-build` | Build a separate crate from the named source file | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
59+
| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make`/`run-make-cargo` | `<extern_prelude_name>=<path/to/aux/file.rs>` |
60+
| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file |
61+
| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make`/`run-make-cargo` | Path to auxiliary proc-macro `.rs` file |
62+
| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make`/`run-make-cargo` | N/A |
6363

6464
[^pm]: please see the [Auxiliary proc-macro section](compiletest.html#auxiliary-proc-macro) in the compiletest chapter for specifics.
6565

@@ -243,18 +243,18 @@ ignoring debuggers.
243243

244244
### Affecting how tests are built
245245

246-
| Directive | Explanation | Supported test suites | Possible values |
247-
|---------------------|----------------------------------------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------------------|
248-
| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` |
249-
| `edition` | The edition used to build the test | All except for `run-make` | Any valid `--edition` value |
250-
| `rustc-env` | Env var to set when running `rustc` | All except for `run-make` | `<KEY>=<VALUE>` |
251-
| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make` | Any env var name |
252-
| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A |
253-
| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |
246+
| Directive | Explanation | Supported test suites | Possible values |
247+
|---------------------|----------------------------------------------------------------------------------------------|--------------------------------------------|--------------------------------------------------------------------------------------------|
248+
| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make`/`run-make-cargo` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` |
249+
| `edition` | The edition used to build the test | All except for `run-make`/`run-make-cargo` | Any valid `--edition` value |
250+
| `rustc-env` | Env var to set when running `rustc` | All except for `run-make`/`run-make-cargo` | `<KEY>=<VALUE>` |
251+
| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make`/`run-make-cargo` | Any env var name |
252+
| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A |
253+
| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |
254254

255255
<div class="warning">
256256

257-
Tests (outside of `run-make`) that want to use incremental tests not in the
257+
Tests (outside of `run-make`/`run-make-cargo`) that want to use incremental tests not in the
258258
incremental test-suite must not pass `-C incremental` via `compile-flags`, and
259259
must instead use the `//@ incremental` directive.
260260

@@ -264,9 +264,9 @@ Consider writing the test as a proper incremental test instead.
264264

265265
### Rustdoc
266266

267-
| Directive | Explanation | Supported test suites | Possible values |
268-
|-------------|--------------------------------------------------------------|------------------------------------------|---------------------------|
269-
| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags |
267+
| Directive | Explanation | Supported test suites | Possible values |
268+
|-------------|--------------------------------------------------------------|-----------------------------------------|---------------------------|
269+
| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags |
270270

271271
<!--
272272
**FIXME(rustdoc)**: what does `check-test-line-numbers-match` do?

src/tests/misc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ In `ui` tests and other test suites that support `//@ rustc-env`, you can specif
2424
//@ rustc-env:RUSTC_BOOTSTRAP=-1
2525
```
2626

27-
For `run-make` tests, `//@ rustc-env` is not supported. You can do something
28-
like the following for individual `rustc` invocations.
27+
For `run-make`/`run-make-cargo` tests, `//@ rustc-env` is not supported. You can do
28+
something like the following for individual `rustc` invocations.
2929

3030
```rust,ignore
3131
use run_make_support::rustc;

0 commit comments

Comments
 (0)