|
| 1 | +# The `run-make` test suite |
| 2 | + |
| 3 | +The `run-make` test suite contains tests which are the most flexible out of all |
| 4 | +the [rust-lang/rust](https://github.com/rust-lang/rust) test suites. `run-make` |
| 5 | +tests can basically contain arbitrary code, and are supported by the |
| 6 | +[`run_make_support`] library. |
| 7 | + |
| 8 | +## Infrastructure |
| 9 | + |
| 10 | +There are two kinds of run-make tests: |
| 11 | + |
| 12 | +1. The new `rmake.rs` version: this allows run-make tests to be written in Rust |
| 13 | + (with `rmake.rs` as the main test file). |
| 14 | +2. The legacy `Makefile` version: this is what run-make tests were written with |
| 15 | + before support for `rmake.rs` was introduced. |
| 16 | + |
| 17 | +The implementation for collecting and building the `rmake.rs` recipes (or |
| 18 | +`Makefile`s) are in |
| 19 | +[`src/tools/compiletest/src/runtest.rs`](../../src/tools/compiletest/src/runtest.rs), |
| 20 | +in `run_rmake_v2_test` and `run_rmake_legacy_test`. |
| 21 | + |
| 22 | +### Rust-based `run-make` tests: `rmake.rs` |
| 23 | + |
| 24 | +The setup for the `rmake.rs` version is a 3-stage process: |
| 25 | + |
| 26 | +1. First, we build the [`run_make_support`] library in bootstrap as a tool lib. |
| 27 | +2. Then, we compile the `rmake.rs` "recipe" linking the support library and its |
| 28 | + dependencies in, and provide a bunch of env vars. We setup a directory |
| 29 | + structure within `build/<target>/test/run-make/` |
| 30 | + |
| 31 | + ``` |
| 32 | + <test-name>/ |
| 33 | + rmake.exe # recipe binary |
| 34 | + rmake_out/ # sources from test sources copied over |
| 35 | + ``` |
| 36 | + |
| 37 | + and copy non-`rmake.rs` input support files over to `rmake_out/`. The |
| 38 | + support library is made available as an [*extern prelude*][extern_prelude]. |
| 39 | +3. Finally, we run the recipe binary and set `rmake_out/` as the working |
| 40 | + directory. |
| 41 | + |
| 42 | +[`run_make_support`]: ../../src/tools/run-make-support |
| 43 | +[extern_prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude |
0 commit comments