|  | 
|  | 1 | +--- | 
|  | 2 | +layout: post | 
|  | 3 | +title: "This Month in Our Test Infra: October 2024" | 
|  | 4 | +author: Jieyou Xu | 
|  | 5 | +team: the Bootstrap Team <https://www.rust-lang.org/governance/teams/infra#team-bootstrap> | 
|  | 6 | +--- | 
|  | 7 | + | 
|  | 8 | +# This Month in Our Test Infra: October 2024 | 
|  | 9 | + | 
|  | 10 | +<!-- time period: 2024-10-09 through 2024-11-04 --> | 
|  | 11 | + | 
|  | 12 | +This is a quick summary of the changes in the test infrastructure for the [rust-lang/rust][r-l/r] | 
|  | 13 | +repository[^scope] for **October 2024**[^spec-date]. It also includes brief descriptions of on-going | 
|  | 14 | +work. | 
|  | 15 | + | 
|  | 16 | +[^scope]: The test infra here refers to the test harness [compiletest] and supporting components in | 
|  | 17 | +our build system [bootstrap]. This test infra is used mainly by rustc and rustdoc. Other tools like | 
|  | 18 | +cargo, miri or rustfmt maintain their own test infra. | 
|  | 19 | +[^spec-date]: specifically 2024-10-09 to 2024-11-04. Note that the previous issue incorrectly used | 
|  | 20 | +    October in the filename and thus URL, but is actually the September issue. | 
|  | 21 | + | 
|  | 22 | +As usual, if you encounter bugs or UX issues when using our test infrastructure, please [file an | 
|  | 23 | +issue][new-issue]. Bugs and papercuts can't be fixed if we don't know about them! | 
|  | 24 | + | 
|  | 25 | +**Thanks to everyone who contributed to our test infra!** | 
|  | 26 | + | 
|  | 27 | +## Highlights | 
|  | 28 | + | 
|  | 29 | +### `compiletest` now supports bringing your own custom diff tool | 
|  | 30 | + | 
|  | 31 | +[`compiletest` (and bootstrap) now supports bringing your own custom diff tool | 
|  | 32 | +(#131181)][custom-diff-tool]. | 
|  | 33 | + | 
|  | 34 | + | 
|  | 35 | + | 
|  | 36 | +This only affects the *visual* diff generation (i.e. maybe you like a different visual style). The | 
|  | 37 | +`.stderr` snapshots and such are not affected. | 
|  | 38 | + | 
|  | 39 | +If you want to use your favorite diff tool for generating the visual diffs, you can modify | 
|  | 40 | +`config.toml`'s `build.compiletest-diff-tool` option: | 
|  | 41 | + | 
|  | 42 | +```toml | 
|  | 43 | +[build] | 
|  | 44 | +# What custom diff tool to use for displaying compiletest tests. | 
|  | 45 | +#compiletest-diff-tool = <none> | 
|  | 46 | +``` | 
|  | 47 | + | 
|  | 48 | +Thanks to [`@dev-ardi`] for the implementation! | 
|  | 49 | + | 
|  | 50 | +[`@dev-ardi`]: https://github.com/dev-ardi | 
|  | 51 | +[custom-diff-tool]: https://github.com/rust-lang/rust/pull/131181 | 
|  | 52 | + | 
|  | 53 | +### `minicore` test auxiliary and `//@ add-core-stubs` directive  | 
|  | 54 | + | 
|  | 55 | +[`ui`, `assembly` and `codegen` tests can now use the `//@ add-core-stubs` directive to | 
|  | 56 | +conditionally build a `minicore` test auxiliary which provides `core` stubs | 
|  | 57 | +(#130693)](https://github.com/rust-lang/rust/pull/130693). This is so that we can share `core` stubs | 
|  | 58 | +between cross-compiling tests that only need to *build* for the cross-compile target and avoid | 
|  | 59 | +having to reinvent and maintain duplicate `minicore` copies in each of such test[^multicore]. | 
|  | 60 | + | 
|  | 61 | +[^multicore]: You can say we currently have more of a... "multicore" situation, heh. | 
|  | 62 | + | 
|  | 63 | +Previously, having to reinvent a `minicore` every time you want to add a distinct | 
|  | 64 | +`ui`/`assembly`/`codegen` test (for checking e.g. cross-compile ABI) is a significant source of | 
|  | 65 | +contributor friction and makes it more prone to introduce mistakes in the `minicore` copies. This is | 
|  | 66 | +also particularly annoying for compiler contributors who want to introduce new lang items, as they | 
|  | 67 | +found themselves having to update multiple copies of such `core` stubs. | 
|  | 68 | + | 
|  | 69 | +Note that currently, the shared [`tests/auxiliary/minicore.rs`][minicore] test auxiliary is still | 
|  | 70 | +quite minimal. The plan is to land the test infrastructure first, then we can incrementally add more | 
|  | 71 | +`core` stubs to the shared test auxiliary. | 
|  | 72 | + | 
|  | 73 | +Example usage: | 
|  | 74 | + | 
|  | 75 | +```rs | 
|  | 76 | +// tests/ui/abi/my-abi-test.rs | 
|  | 77 | + | 
|  | 78 | +#![crate_type = "lib"] | 
|  | 79 | +#![feature(no_core)] | 
|  | 80 | +#![no_std] | 
|  | 81 | +#![no_core] | 
|  | 82 | + | 
|  | 83 | +extern crate minicore; | 
|  | 84 | +use minicore::*; | 
|  | 85 | + | 
|  | 86 | +struct Meow; | 
|  | 87 | +impl Copy for Meow {} // `Copy` is provided by `minicore`! | 
|  | 88 | +``` | 
|  | 89 | + | 
|  | 90 | +See the [context issue][minicore-ctxt], [MCP][minicore-mcp] and [tracking issue][minicore-tracking] | 
|  | 91 | +for more info on the original motivations. See the [rustc-dev-guide][minicore-dev-guide] chapter for | 
|  | 92 | +example usage. | 
|  | 93 | + | 
|  | 94 | +[minicore]: https://github.com/rust-lang/rust/blob/master/tests/auxiliary/minicore.rs | 
|  | 95 | +[minicore-ctxt]: https://github.com/rust-lang/rust/issues/130375 | 
|  | 96 | +[minicore-tracking]: https://github.com/rust-lang/rust/issues/131485 | 
|  | 97 | +[minicore-mcp]: https://github.com/rust-lang/compiler-team/issues/786 | 
|  | 98 | +[minicore-dev-guide]: https://rustc-dev-guide.rust-lang.org/tests/minicore.html | 
|  | 99 | + | 
|  | 100 | +## PR listing | 
|  | 101 | + | 
|  | 102 | +### Improvements | 
|  | 103 | + | 
|  | 104 | +- General test infra: [Add `minicore` test auxiliary and support `//@ add-core-stubs` directive in `ui`/`assembly`/`codegen` tests #130693](https://github.com/rust-lang/rust/pull/130693) | 
|  | 105 | +- [compiletest]: [Add test infra to explicitly test rustc with `autodiff`/`enzyme` disabled #131470](https://github.com/rust-lang/rust/pull/131470) | 
|  | 106 | +- [compiletest]: [Special case error message for a `build-fail` test that failed check build #131642](https://github.com/rust-lang/rust/pull/131642) | 
|  | 107 | +- [compiletest]: [Document various parts of compiletest's lib.rs #131679](https://github.com/rust-lang/rust/pull/131679) | 
|  | 108 | +- [compiletest]: [Fix unnecessary nesting in run-make test output directories #131764](https://github.com/rust-lang/rust/pull/131764) | 
|  | 109 | +- [compiletest]: [Warn on redundant --cfg directive when revisions are used #131925](https://github.com/rust-lang/rust/pull/131925) | 
|  | 110 | +- [compiletest]: [Disambiguate html-tidy from rust tidy tool #131941](https://github.com/rust-lang/rust/pull/131941) | 
|  | 111 | +- [compiletest]: [Custom differ #131181](https://github.com/rust-lang/rust/pull/131181) | 
|  | 112 | +- [compiletest]: [Don't allow test revisions that conflict with built in `cfg`s #131930](https://github.com/rust-lang/rust/pull/131930) | 
|  | 113 | +- [compiletest]: [Dynamically link run-make support #132225](https://github.com/rust-lang/rust/pull/132225) | 
|  | 114 | +- [compiletest]: [Improve robustness of LLVM version handling #132315](https://github.com/rust-lang/rust/pull/132315) | 
|  | 115 | +- [compiletest]: [Add "reference" as a known compiletest header #131382](https://github.com/rust-lang/rust/pull/131382)[^spec] | 
|  | 116 | +- `tests/run-make`, CI: [Add `aarch64-gnu-debug` job #131207](https://github.com/rust-lang/rust/pull/131207) | 
|  | 117 | +- meta: [Tag PRs affecting compiletest with A-compiletest #131682](https://github.com/rust-lang/rust/pull/131682) | 
|  | 118 | + | 
|  | 119 | +[^spec]: This is part of T-spec efforts to associate tests with Reference rules. | 
|  | 120 | + | 
|  | 121 | +### Fixes | 
|  | 122 | + | 
|  | 123 | +- [compiletest]: [Fix up-to-date checking for run-make tests #131681](https://github.com/rust-lang/rust/pull/131681) | 
|  | 124 | +- [compiletest]: [Suppress Windows Error Reporting (WER) for run-make tests](https://github.com/rust-lang/rust/pull/132093)[^wer-fun] | 
|  | 125 | +- [compiletest]: [Error on trying to use revisions in run-make tests #131614](https://github.com/rust-lang/rust/pull/131614) | 
|  | 126 | +- `tests/run-make`, CI: [Run the full stage 2 `run-make` test suite in `x86_64-gnu-debug` #131917](https://github.com/rust-lang/rust/pull/131917) | 
|  | 127 | +- [bootstrap], `tests/run-make`: [Don't stage-off to previous compiler when CI rustc is available #132006](https://github.com/rust-lang/rust/pull/132006) | 
|  | 128 | +- [bootstrap], `tests/mir-opt`: [Match std `RUSTFLAGS` for host and target for `mir-opt` test suite to fix double std build/rebuilds #131442](https://github.com/rust-lang/rust/pull/131442)  | 
|  | 129 | +- emscripten: Fix [bootstrap] and [compiletest] handling of emscripten target tests as part of [Fix most ui tests on emscripten target #131705](https://github.com/rust-lang/rust/pull/131705) | 
|  | 130 | + | 
|  | 131 | +[^wer-fun]: If you want to see what unsuppressed Windows Errors Reporting looks like for the `run-make` test suite, see <https://github.com/rust-lang/rust/issues/132092#issuecomment-2436615833>. | 
|  | 132 | + | 
|  | 133 | +### Cleanups | 
|  | 134 | + | 
|  | 135 | +- [compiletest]: [Extract auxiliary-crate properties to their own module/struct #131541](https://github.com/rust-lang/rust/pull/131541) | 
|  | 136 | +- [compiletest]: [Rename directive `needs-profiler-support` to `needs-profiler-runtime` #131429](https://github.com/rust-lang/rust/pull/131429) | 
|  | 137 | +- [compiletest]: [Move debugger setup code out of lib.rs #131638](https://github.com/rust-lang/rust/pull/131638) | 
|  | 138 | +- [compiletest]: [Remove the one thing that was checking a directive's original_line #131585](https://github.com/rust-lang/rust/pull/131585) | 
|  | 139 | +- [compiletest]: [Store test collection context/state in two structs #131870](https://github.com/rust-lang/rust/pull/131870) | 
|  | 140 | +- [compiletest]: [Tidy up how tidy and tidy (html version) are disambiguated #131961](https://github.com/rust-lang/rust/pull/131961) | 
|  | 141 | +- [compiletest]: [Make `line_directive` return a `DirectiveLine` #132033](https://github.com/rust-lang/rust/pull/132033) | 
|  | 142 | +- [compiletest]: [Rename `command-list.rs` to `directive-list.rs` #132313](https://github.com/rust-lang/rust/pull/132313) | 
|  | 143 | +- [compiletest]: [Remove the magic hacks for finding output with `lto=thin` #131524](https://github.com/rust-lang/rust/pull/131524) | 
|  | 144 | +- [compiletest]: [Simplify the choice of `--emit` mode for assembly tests #131525](https://github.com/rust-lang/rust/pull/131525) | 
|  | 145 | +- [compiletest]: [Move debugger setup code out of lib.rs #131638](https://github.com/rust-lang/rust/pull/131638) | 
|  | 146 | + | 
|  | 147 | +### Documentation updates | 
|  | 148 | + | 
|  | 149 | +- [rustc-dev-guide]: [Document compiletest directives `ignore-coverage-map` and `ignore-coverage-run` #2094](https://github.com/rust-lang/rustc-dev-guide/pull/2094) | 
|  | 150 | +- [rustc-dev-guide]: [Rename `needs-profiler-support` to `needs-profiler-runtime` #2095](https://github.com/rust-lang/rustc-dev-guide/pull/2095) | 
|  | 151 | +- [rustc-dev-guide]: [Fix and update docs for `needs-force-clang-based-tests` #2085](https://github.com/rust-lang/rustc-dev-guide/pull/2085) | 
|  | 152 | +- [rustc-dev-guide]: [Add redirects for integration-testing and headers #2092](https://github.com/rust-lang/rustc-dev-guide/pull/2092) | 
|  | 153 | +- [rustc-dev-guide]: [Describe minicore test auxiliary and directive #2097](https://github.com/rust-lang/rustc-dev-guide/pull/2097) | 
|  | 154 | +- [rustc-dev-guide]: [Fix minicore.rs link #2122](https://github.com/rust-lang/rustc-dev-guide/pull/2122) | 
|  | 155 | +- [rustc-dev-guide]: [Add a link for the `reference` compiletest header #2096](https://github.com/rust-lang/rustc-dev-guide/pull/2096) | 
|  | 156 | + | 
|  | 157 | +## On-going efforts | 
|  | 158 | + | 
|  | 159 | +Note: there are certainly many more spontaneous efforts, this is more what I know is "planned". | 
|  | 160 | + | 
|  | 161 | +- [Reworking `compiletest` directive handling to be more robust and improve test coverage](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/.28Rubberducking.29.20compiletest.20test.20discovery.20.2F.20directives) | 
|  | 162 | + | 
|  | 163 | + | 
|  | 164 | +[r-l/r]: https://github.com/rust-lang/rust | 
|  | 165 | +[rustc-dev-guide]: https://github.com/rust-lang/rustc-dev-guide | 
|  | 166 | +[compiletest]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest | 
|  | 167 | +[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap | 
|  | 168 | +[new-issue]: https://github.com/rust-lang/rust/issues/new | 
0 commit comments