about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2025-07-20Add new `needs-backends` tests annotationsGuillaume Gomez-0/+25
2025-07-20Add new `ignore-backends` tests annotationsGuillaume Gomez-2/+75
2025-07-19tests: Require `run-fail` ui tests to have an exit code (`SIGABRT` not ok)Martin Nordholts-12/+88
And introduce two new directives for ui tests: * `run-crash` * `run-fail-or-crash` Normally a `run-fail` ui test like tests that panic shall not be terminated by a signal like `SIGABRT`. So begin having that as a hard requirement. Some of our current tests do terminate by a signal/crash however. Introduce and use `run-crash` for those tests. Note that Windows crashes are not handled by signals but by certain high bits set on the process exit code. Example exit code for crash on Windows: `0xc000001d`. Because of this, we define "crash" on all platforms as "not exit with success and not exit with a regular failure code in the range 1..=127". Some tests behave differently on different targets: * Targets without unwind support will abort (crash) instead of exit with failure code 101 after panicking. As a special case, allow crashes for `run-fail` tests for such targets. * Different sanitizer implementations handle detected memory problems differently. Some abort (crash) the process while others exit with failure code 1. Introduce and use `run-fail-or-crash` for such tests.
2025-07-15Rollup merge of #142301 - Gelbpunkt:duplicated-path-in-error-musl, ↵Samuel Tardieu-0/+1
r=workingjubilee,fmease,jieyouxu tests: Fix duplicated-path-in-error fail with musl musl's dlopen returns a different error than glibc, which contains the name of the file. This would cause the test to fail, since the filename would appear twice in the output (once in the error from rustc, once in the error message from musl). Split the expected test outputs for the different libc implementations. Fixes rust-lang/rust#128474
2025-07-14tests: Fix duplicated-path-in-error fail with muslJens Reidel-0/+1
musl's dlopen returns a different error than glibc, which contains the name of the file. This would cause the test to fail, since the filename would appear twice in the output (once in the error from rustc, once in the error message from musl). Split the expected test outputs for the different libc implementations. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-14Rollup merge of #143870 - jieyouxu:compiletest-maintenance-6, r=KobzolSamuel Tardieu-20/+44
[COMPILETEST-UNTANGLE 6/N] Use `TestSuite` enum instead of stringly-typed test suites This is part of a patch series to untangle `compiletest` to hopefully nudge it towards being more maintainable. This PR should contain no functional changes.
2025-07-14Use `TestSuite` enum instead of stringly-typed test suitesJieyou Xu-20/+44
2025-07-13Compiletest: Simplify {Html,Json}DocCk directive handlingLeón Orell Valerian Liehr-289/+275
2025-07-13Rollup merge of #143823 - jieyouxu:compiletest-maintenance-5, r=KobzolLeón Orell Valerian Liehr-163/+252
[COMPILETEST-UNTANGLE 5/N] Test mode adjustments and other assorted cleanups This is part of a patch series to untangle `compiletest` to hopefully nudge it towards being more maintainable. This PR should contain no functional changes modulo the removed debugger version warning. - Commit 1: Removes a very outdated debugger version warning. - Commit 2: Moves `string_enum` out of `common` into `util` module. - Commit 3: Remove `#[derive(Default)` for `Mode` and `Config`. It is very important for correctness that we *don't* `#[derive(Default)]`, because there are no sensible defaults, so stop pretending there is. - Commit 4: Rename `Mode` -> `TestMode`, because I would like to introduce a `TestSuite` enum to stop using stringly-typed test suite names where test mode names can be the same as test suite names, and we also have a bunch of other "modes" in compiletest. Make this as unambiguous as possible. A corollary is that now it's more natural to reference via intra-doc links as ``[`TestMode`]``. - Commit 5: Ditto on `TestSuite`, stop glob-reexporting `TestMode::*` variants, and always use `EnumName::VariantName` form. - Commit 6: Apparently, `src/tools/rustdoc-gui-test/` depends on `compiletest` for `//@ {compile,run}-paths` directive parsing and extraction, which involves creating a dummy `compiletest` config (hence the existence of the default impls removed in Commit 3). Make this a specific associated function with a FIXME pointing to rust-lang/rust#143827 as I think this setup is quite questionable. Commits {4, 5} are also intended to help improve the self-consistency in nomenclature used within compiletest. Best reviewed commit-by-commit.
2025-07-12Make rustdoc-gui-test dummy compiletest config purpose explicitJieyou Xu-0/+101
2025-07-12Do not glob-reexport `TestMode` variantsJieyou Xu-53/+65
I would like to introduce `TestSuite` over stringly-typed test suite names, and some test suite names are the same as test modes, which can make this very confusing.
2025-07-12Rename `Mode` to `TestMode`Jieyou Xu-44/+44
It is *critical* that we maintain clear nomenclature in `compiletest`. We have many types of "modes" in `compiletest` -- pass modes, coverage modes, compare modes, you name it. `Mode` is also a *super* general term. Rename it to `TestMode` to leave no room for such ambiguity. As a follow-up, I also intend to introduce an enum for `TestSuite`, then rid of all usage of glob re-exported `TestMode::*` enum variants -- many test suites share the same name as the test mode.
2025-07-12Do not allow defaults for `Mode` and `Config`Jieyou Xu-7/+1
They do not have sensible defaults, and it is crucial that we get them right.
2025-07-12Move `string_enum` to `util` moduleJieyou Xu-49/+42
2025-07-12Remove outdated debugger version warningJieyou Xu-11/+0
2025-07-11Disambiguate between rustc vs std having debug assertionsJieyou Xu-0/+13
Additionally, `NO_DEBUG_ASSERTIONS` is set by CI that threads through to the `./configure` script, which is somewhat fragile and "spooky action at a distance". Instead, use env vars controlled by compiletest, whose debug assertion info comes from bootstrap.
2025-07-10Remove uncessary parens in closure body with unused lintyukang-0/+6
2025-07-06Rollup merge of #143504 - RalfJung:compiletest-err, r=jieyouxuMatthias Krüger-1/+2
compiletest: print slightly more information on fs::write failure See [#t-infra > compiletest: panic in dump_output_file: No such file or dire @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/compiletest.3A.20panic.20in.20dump_output_file.3A.20No.20such.20file.20or.20dire/near/527294714)
2025-07-05compiletest: print slightly more information on fs::write failureRalf Jung-1/+2
2025-07-05Improve compiletest config documentationJieyou Xu-93/+353
Including a bunch of FIXMEs.
2025-07-02Rename {`HeadersCache`, `iter_header`} -> {`DirectivesCache`, ↵Jieyou Xu-14/+14
`iter_directives`} for self-consistency
2025-07-02Update compiletest to use "directive" terminology consistentlyJieyou Xu-24/+23
2025-07-02Rename `header` -> `directives`Jieyou Xu-11/+11
compiletest has confusingly two terminology to refer to the same concept -- "headers" and "directives". To make this more self-consistent and less confusing, stick with "directives" only. This commit **intentionally** tries to be limited to move-only (modulo some key usage reference renames) to help git history.
2025-07-01Make some compiletest errors/warnings/help more visually obviousJieyou Xu-38/+84
2025-06-30Move `RUST_TEST_NOCAPTURE` warning to early config checkJieyou Xu-6/+7
2025-06-30Move compiletest `main.rs` to `src/bin/`Jieyou Xu-0/+4
To make it obvious `compiletest`-the-tool has two components: 1. The core compiletest library, and 2. The tool binary, which will be executed by bootstrap.
2025-06-30Move some early config checks to the compiletest libJieyou Xu-14/+17
2025-06-26Fix some fixmes that were waiting for let chainsYotam Ofek-3/+3
2025-06-23compiletest: Improve diagnostics for line annotation mismatchesVadim Petrochenkov-76/+159
2025-06-22forward the bootstrap `runner` to `run-make`Folkert de Vries-0/+4
The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.
2025-06-18Auto merge of #142689 - Urgau:rollup-4ho6835, r=Urgaubors-0/+6
Rollup of 6 pull requests Successful merges: - rust-lang/rust#135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused) - rust-lang/rust#138237 (Get rid of `EscapeDebugInner`.) - rust-lang/rust#141614 (lint direct use of rustc_type_ir ) - rust-lang/rust#142123 (Implement initial support for timing sections (`--json=timings`)) - rust-lang/rust#142377 (Try unremapping compiler sources) - rust-lang/rust#142674 (remove duplicate crash test) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-18Rollup merge of #142377 - Urgau:unremap-rustc-dev, r=jieyouxuUrgau-0/+6
Try unremapping compiler sources See [#t-compiler/help > Span pointing to wrong file location (`rustc-dev` component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083). This PR is a follow-up to rust-lang/rust#141751 regarding the compiler side. Specifically we now take into account the `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` env from rust-lang/rust#141751 when trying to unremap sources from `$sysroot/lib/rustlib/rustc-src/rust` (the `rustc-dev` component install directory). Best reviewed commit by commit. cc ``@samueltardieu`` r? ``@jieyouxu``
2025-06-18Rollup merge of #142672 - Kobzol:bootstrap-tool-clarification, r=jieyouxuJakub Beránek-3/+3
Clarify bootstrap tools description The existence of `stage0-bootstrap-tools` suggests the possiblity of `stage1/N-bootstrap-tools`, but that's not really a thing. Also it doesn't fit the new bootstrap model, where `stageN` essentially means that it was built with a `stageN-1` compiler (except for std). r? ``@jieyouxu``
2025-06-18Fix compiletest and rustc-dev-guideJakub Beránek-3/+3
2025-06-17apply clippy::or_fun_callklensy-4/+5
2025-06-15Un-remap `rustc-dev` component pathsUrgau-0/+6
2025-06-13compiletest: Clarify that `--no-capture` is needed with `--verbose`Martin Nordholts-0/+1
Confusingly, this does not make compile test print what command is used to run a ui test: ./x test tests/ui/panics/abort-on-panic.rs --verbose It is also necessary to pass `--no-capture`, like this: ./x test tests/ui/panics/abort-on-panic.rs --verbose --no-capture Now you will see prints like this: executing cd "/rust/build/x86_64-unknown-linux-gnu/test/ui/panics/abort-on-panic.next" && \ RUSTC="/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" \ RUST_TEST_THREADS="32" \ "/rust/build/x86_64-unknown-linux-gnu/test/ui/panics/abort-on-panic.next/a" Add a hint in the code for this that would have helped me figure this out.
2025-06-10Implement `//@ needs-target-std` directive in compiletestJieyou Xu-0/+17
To support tests to condition their (potentially cross-compile) execution based on whether the target supports std.
2025-06-06Add new Tier-3 targets: `loongarch32-unknown-none*`WANG Rui-0/+3
MCP: https://github.com/rust-lang/compiler-team/issues/865
2025-05-17compiler & tools: bump windows crate to dedupe versionsklensy-1/+1
2025-05-12compiletest: fix "blessing" messageJieyou Xu-8/+12
It was showing compare mode instead of test name.
2025-05-09Remove mono item collection strategy override from -Zprint-mono-itemsTomasz Miąsko-1/+4
Previously `-Zprint-mono-items` would override the mono item collection strategy. When debugging one doesn't want to change the behaviour, so this was counter productive. Additionally, the produced behaviour was artificial and might never arise without using the option in the first place (`-Zprint-mono-items=eager` without `-Clink-dead-code`). Finally, the option was incorrectly marked as `UNTRACKED`. Resolve those issues, by turning `-Zprint-mono-items` into a boolean flag that prints results of mono item collection without changing the behaviour of mono item collection. For codegen-units test incorporate `-Zprint-mono-items` flag directly into compiletest tool. Test changes are mechanical. `-Zprint-mono-items=lazy` was removed without additional changes, and `-Zprint-mono-items=eager` was turned into `-Clink-dead-code`. Linking dead code disables internalization, so tests have been updated accordingly.
2025-05-07[win][arm64] Disable various DebugInfo tests that don't work on Arm64 WindowsDaniel Paoliello-0/+1
2025-05-04compiletest: Support matching on non-json lines in compiler outputVadim Petrochenkov-90/+49
and migrate most of remaining `error-pattern`s to it.
2025-05-03compiletest: Do not require annotations on empty labels and suggestionsVadim Petrochenkov-10/+13
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-45/+28
2025-04-28compiletest: Remove the libtest-based executor and its dependencyZalathar-132/+7
This patch has deliberately been kept small and simple, to make it easier to revert if necessary. Further cleanup can take palce after we're confident that it won't need to be reverted.
2025-04-26Auto merge of #140288 - Zalathar:new-executor, r=jieyouxubors-7/+11
compiletest: Re-land using the new non-libtest executor by default This PR re-lands #139998, which had the misfortune of triggering download-rustc in its CI jobs, so we didn't get proper test metrics for comparison with the old implementation. So that was PR was reverted in #140233, with the intention of re-landing it alongside a dummy compiler change to inhibit download-rustc. --- Original PR description for #139998: >The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong. > >Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong. > >As before, there *should* be no user-visible difference between the old executor and the new executor. --- r? jieyouxu
2025-04-26Auto merge of #140177 - tmandry:compiletest-par, r=jieyouxubors-38/+60
[compiletest] Parallelize test discovery Certain filesystems are slow to service individual read requests, but can service many in parallel. This change brings down the time to run a single cached test on one of those filesystems from 40s to about 8s.
2025-04-25compiletest: Use the new non-libtest executor by default (2)Zalathar-7/+11
(Re-landing #139998, with a compiler change to inhibit download-rustc.) Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency.