about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2025-10-04Rollup merge of #147288 - Zalathar:directive, r=jieyouxuMatthias Krüger-156/+188
compiletest: Make `DirectiveLine` responsible for name/value splitting - Follow-up to rust-lang/rust#147170. --- Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent. The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits. r? jieyouxu
2025-10-04Rollup merge of #147280 - ↵Matthias Krüger-4/+1
workingjubilee:you-can-put-your-gcc-in-my-llvm-components, r=Kobzol Return to needs-llvm-components being info-only Partially revert a535042e80a38196a58c27a8c95552546affe5dc Even with non-LLVM codegen backends, we want to allow for annotations that express dependencies to LLVM-specific parts of the test suite. This includes `//@ needs-llvm-components`, which just allows checking that LLVM is built with relevant target support before the test is run. It does not assert the test cannot work with another codegen backend.
2025-10-03Use new `DirectiveLine` features in directive parsingZalathar-89/+73
2025-10-03Allow easy extraction of name/value from a `DirectiveLine`Zalathar-5/+50
2025-10-03Move `DirectiveLine` into its own submoduleZalathar-66/+69
2025-10-02Return to needs-llvm-components being info-onlyJubilee Young-4/+1
Partially revert a535042e80a38196a58c27a8c95552546affe5dc Even with non-LLVM codegen backends, we want to allow for annotations that express dependencies to LLVM-specific parts of the test suite. This includes `//@ needs-llvm-components`, which just allows checking that LLVM is built with relevant target support before the test is run. It does not assert the test cannot work with another codegen backend.
2025-10-02implement range support in `//@ edition`Pietro Albini-14/+270
2025-10-02Forbid `//@ compile-flags: -Cincremental=` in testsZalathar-1/+9
Tests should not try to manually enable incremental compilation with `-Cincremental`, because that typically results in stray directories being created in the repository root. Instead, use the `//@ incremental` directive, which instructs compiletest to handle the details of passing `-Cincremental` with a fresh directory.
2025-09-30Pass around `DirectiveLine` instead of bare stringsZalathar-145/+107
2025-09-30Remove `parse_negative_name_directive`Zalathar-16/+2
This isn't actually used for anything, and its presence complicates the migration to `DirectiveLine`.
2025-09-30Split off a separate name/value parser for debuginfo test commandsZalathar-16/+19
2025-09-29Rollup merge of #146929 - Zalathar:capture, r=Kobzol,jieyouxuStuart Cook-66/+10
compiletest: Remove old-output-capture and become a stage0 bootstrap tool The new compiletest output-capture system became the default in rust-lang/rust#146574, and no problems have been reported since. This PR therefore removes the old output-capture implementation from compiletest, and adjusts bootstrap to always build and test compiletest as a stage0 bootstrap tool. In other words, compiletest no longer relies on any unstable features (such as `libtest` or `internal_output_capture`), and is now written entirely in stable Rust! The compiletest self-tests still need access to an in-tree rustc, in order to obtain information via `rustc --print`, so we interpret `--stage` as indicating the stage of that secondary compiler, but always use the stage0 compiler to build compiletest itself. r? Kobzol
2025-09-28Remove old-output-capture from compiletestZalathar-66/+10
2025-09-27Use `PanicHookInfo::payload_as_str` now that it's stable in betaZalathar-14/+1
2025-09-24Rollup merge of #146969 - RalfJung:maybe-null-errors, r=oli-obkMatthias Krüger-1/+1
const-eval: better wording for errors involving maybe-null pointers Fixes https://github.com/rust-lang/rust/issues/146748 r? ``@oli-obk``
2025-09-24const validation: better error for maybe-null referencesRalf Jung-1/+1
2025-09-23Rollup merge of #146731 - Muscraft:svg-test-terminal-url, r=jdonszelmannMatthias Krüger-1/+1
test: Use SVG for terminal url test I came across the test for `-Zterminal-urls` and found its output a bit hard to read. So, I decided to switch it to an SVG test, as I found it easier to differentiate the link and link text. Note: `anstyle-svg` needed to be upgraded to at least `0.1.8` to support links in SVGs, so I went ahead and upgraded it to the latest version (`0.1.11`).
2025-09-21Add panic=immediate-abortBen Kimock-7/+35
2025-09-19chore(compiletest): Use newest anstyle-svg versionScott Schafer-1/+1
2025-09-16Rollup merge of #146618 - GuillaumeGomez:backend-run-llvm-options, r=kobzolMatthias Krüger-5/+12
Do not run ui test if options specific to LLVM are used when another codegen backend is used Based on errors in https://github.com/rust-lang/rust/pull/146414, some tests with LLVM-specific options are run when another codegen is actually the one used. This PR ignores these tests in such cases now to prevent this situation. r? `@kobzol`
2025-09-16Do not run ui test if options specific to llvm are used when another codegen ↵Guillaume Gomez-5/+12
backend is used
2025-09-16Rollup merge of #146601 - Enselic:fix-test-args, r=Mark-SimulacrumStuart Cook-3/+6
compiletest: Make `./x test --test-args ...` work again It accidentally broke with https://github.com/rust-lang/rust/pull/146501. The intention of that PR was to keep existing behavior if `--exact` is not used, but it had a bug. This PR fixes that bug.
2025-09-16Rollup merge of #146574 - Zalathar:capture, r=jieyouxuStuart Cook-1/+1
compiletest: Enable new-output-capture by default The new output-capture implementation was added in rust-lang/rust#146119, but was disabled by default and required opt-in. Since then, I haven't encountered any problems in my own testing/usage, and I haven't heard any problem reports from other contributors who might have opted in. It's unlikely that more opt-in testing will help, so the next step is to enable new-output-capture by default and see if anyone complains. (Hopefully nobody!) If needed, the new default can be overridden (for now) by setting environment variable `COMPILETEST_NEW_OUTPUT_CAPTURE=off`. Please file an issue (or let me know) if anyone finds a reason to do this. r? jieyouxu
2025-09-15compiletest: Make `./x test --test-args ...` work againMartin Nordholts-3/+6
It accidentally broke with a48c8e337d1. The intention of that commit was to keep existing behavior if `--exact` is not used, but it had a bug. This commit fixes that bug.
2025-09-15compiletest: Enable new-output-capture by defaultZalathar-1/+1
2025-09-13compiletest: Fix `--exact` test filteringMartin Nordholts-11/+54
This fix only changes the behavior when using `--exact` test filtering, which was quite broken. Before this fix, the following runs 0 tests: $ ./x test tests/run-make/crate-loading -- --exact running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 431 filtered out; finished in 24.95µs With the fix the desired test is run: $ ./x test tests/run-make/crate-loading -- --exact running 1 tests test [run-make] tests/run-make/crate-loading ... ok Without `--exact` the set of run tests is unchanged. This still runs "too many" tests $ ./x test tests/run-make/crate-loading running 3 tests test [run-make] tests/run-make/crate-loading-crate-depends-on-itself ... ok test [run-make] tests/run-make/crate-loading-multiple-candidates ... ok test [run-make] tests/run-make/crate-loading ... ok This still runs the one and only right test: $ ./x test tests/ui/lint/unused/unused-allocation.rs running 1 tests test [ui] tests/ui/lint/unused/unused-allocation.rs ... ok
2025-09-05compiletest: implement {`run-make`,`run-make-cargo`} test suite splitJieyou Xu-7/+10
- `run-make` test suite will now no longer receive a `cargo`. - NOTE: the user could technically still write `Command::new("cargo")` which might find *a* cargo from the environment, but that is not a supported case. - `run-make-cargo` will receive a built in-tree `cargo`.
2025-09-04Rollup merge of #146119 - Zalathar:capture, r=jieyouxuJacob Pratt-75/+275
compiletest: Implement an experimental `--new-output-capture` mode Thanks to the efforts on rust-lang/rust#140192, compiletest no longer has an unstable dependency on libtest, but it still has an unstable dependency on `#![feature(internal_output_capture)]`. That makes building compiletest more complicated than for most other bootstrap tools. This PR therefore adds opt-in support for an experimental compiletest mode that avoids the use of `internal_output_capture` APIs, and instead uses more mundane means to capture the output of individual test runners. Each `TestCx` now contains `&dyn ConsoleOut` references for stdout and stderr. All print statements in `compiletests::runtest` have been replaced with `write!` or `writeln!` calls that explicitly write to one of those trait objects. The underlying implementation then forwards to `print!` or `eprint!` (for `--no-capture` or old-output-capture mode), or writes to a separate buffer (in new-output-capture mode). --- Currently, new-output-capture is disabled by default. It can be explicitly enabled in one of two ways: - When running `x test`, pass `--new-output-capture=on` as a *compiletest* argument (after `--`). - E.g. `x test ui -- --new-output-capture=on`. - The short form is `-Non` or `-Ny`. - Set environment variable `COMPILETEST_NEW_OUTPUT_CAPTURE=on`. After some amount of opt-in testing, new-output-capture will become the default (with a temporary opt-out). Eventually, old-output-capture and `#![feature(internal_output_capture)]` will be completely removed from compiletest. r? jieyouxu
2025-09-04Implement compiletest `--new-output-capture`, in stable RustZalathar-2/+76
2025-09-02compiletest: cygwin follows windows in using PATH for dynamic librariesjeremyd2019-1/+1
2025-09-02Replace print statements in runtest with `write!` or `writeln!`Zalathar-60/+98
2025-09-02Preliminary plumbing of stdout/stderr as `&dyn ConsoleOut`Zalathar-8/+60
2025-09-02Encapsulate output-capture mode in a dedicated enumZalathar-7/+43
2025-09-02Revert introduction of `[workspace.dependencies]`.Nicholas Nethercote-4/+4
This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy. This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-01Capture panic messages via a custom panic hookZalathar-0/+152
2025-08-31Rollup merge of #144443 - WaffleLapkin:integer-target-pointer-width, r=NoratriebMatthias Krüger-7/+1
Make target pointer width in target json an integer r? Noratrieb cc `@RalfJung` (https://github.com/rust-lang/rust/pull/142352/files#r2230380120) try-job: x86_64-rust-for-linux
2025-08-29Rollup merge of #145982 - Zalathar:logv, r=jieyouxuMatthias Krüger-83/+30
compiletest: Reduce the number of `println!` calls that don't have access to `TestCx` In order to stop using `#![feature(internal_output_capture)]` in compiletest, we need to be able to capture the console output of individual tests run by the executor. The approach I have planned is to have all test runners print “console” output into a trait object that is passed around as part of `TestCx`, since almost all test-runner code has easy access to that context. So `println!("foo")` will become `writeln!(self.stdout, "foo")`, and so on. In order to make that viable, we need to avoid unnecessary printing in places that don't have easy access to `TestCx`. To do so, we can either get rid of unnecessary print statements, or rearrange the code to make the context available. This PR uses both approaches. r? jieyouxu
2025-08-29Don't print captures in `TestCx::normalize_platform_differences`Zalathar-7/+4
This appears to have been leftover debugging code. If the capture information turns out to have still been useful, we can find a way to emit it in a way that doesn't interfere with overhauling compiletests's output capture system.
2025-08-29Move module `compute_diff` into `compiletest::runtest`Zalathar-5/+4
The code in this module is always called in the context of running an individual tests, and sometimes prints output that needs to be captured. Moving this module into `runtest` will make it easier to find and audit all of the print statements that need to be updated when overhauling output-capture.
2025-08-29Change the `logv` function into a `TestCx` method.Zalathar-23/+19
When working on a new output-capture system, this will make it easier to obtain a capturing stream from the test context.
2025-08-29Don't bother logging an arbitrary subset of the compiletest configZalathar-48/+3
Running `./x --verbose` will still print out the command-line arguments, and setting `RUST_LOG=compiletest` will now log the full config instead of a subset.
2025-08-29Rollup merge of #145947 - nnethercote:workspace-members-2, r=KobzolStuart Cook-3/+3
Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml` Following on from rust-lang/rust#145740. r? `@Kobzol`
2025-08-28Rollup merge of #145926 - Zalathar:no-libtest, r=jieyouxuStuart Cook-88/+53
compiletest: Remove several remnants of the old libtest-based executor I noticed a few bits of low-hanging cleanup that are possible now that the non-libtest executor is well and truly established.
2025-08-28Add `indexmap` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-28Add `serde_json` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-28Add `libc` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-27accept integer `target-pointer-width` in compiletestWaffle Lapkin-7/+1
2025-08-27Remove several remnants of the old libtest-based executorZalathar-88/+53
2025-08-27Rollup merge of #145885 - madsmtm:lldb-inherit-tcc, r=KobzolMatthias Krüger-0/+29
Inherit TCC in debuginfo tests on macOS macOS has a system for propagating folder permissions, which LLDB disables when spawning processes, which in turn causes debuginfo tests to spam the user with repeated pop-ups asking for permissions. See the code comment for details, as well as the following video for an example of how this looks in practice: https://github.com/user-attachments/assets/1e54f5b8-9130-4b59-8e92-1db1e58fb361 I stumbled upon the incantation to fix this (`settings set target.inherit-tcc true`) while investigating slowdowns when spawning newly created binaries due to XprotectService, see [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/build.20scripts.20slow.20on.20macOS.3F). This would allow me to no longer have a `build.build-dir = "/Users/madsmtm/rust-build"` workaround in my `bootstrap.toml`.
2025-08-27Add `tracing` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1