about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2025-04-10compiletest: Turn `TestProps::require_annotations` into a setVadim Petrochenkov-46/+19
and further simplify its checking in runtest
2025-04-10compiletest: Make `SUGGESTION` annotations viralVadim Petrochenkov-3/+10
2025-04-10Rollup merge of #139609 - jieyouxu:compiletest-path-misc, r=KobzolMatthias Krüger-22/+23
compiletest: don't use stringly paths for `compose_and_run` Eventually I'd like to fully migrate to `camino`'s `{Utf8Path,Utf8PathBuf}` because compiletest assumes UTF-8 paths all over the place, so this is an precursor change to make the migration diff cleaner. r? `@Kobzol` (or bootstrap/compiler)
2025-04-10Rollup merge of #139606 - jieyouxu:compiletest-edition2024, r=compiler-errorsMatthias Krüger-15/+44
Update compiletest to Edition 2024 r? bootstrap (or compiler) try-job: x86_64-apple-1 try-job: x86_64-msvc-1 try-jbo: x86_64-mingw-1
2025-04-10Rollup merge of #139507 - Zalathar:trim-env-name, r=jieyouxuMatthias Krüger-16/+13
compiletest: Trim whitespace from environment variable names When a test contains a directive like `//@ exec-env: FOO=bar`, compiletest currently includes that leading space in the name of the environment variable, so it is defined as ` FOO` instead of `FOO`. This is an annoying footgun that is pretty much never intended, especially since most other directives *do* trim whitespace. So let's get rid of it by trimming the environment variable name. Values remain untrimmed, since there could conceivably be a use-case for values with leading space, but perhaps we'll end up trimming values too in the future. Recently observed in https://github.com/rust-lang/rust/pull/138603#issuecomment-2783709359. Fixes #132990. Supersedes #133148. --- try-job: test-various
2025-04-10include --edition in the compiletest stampPietro Albini-0/+1
2025-04-10prevent configuring the edition with //@compile-flagsPietro Albini-1/+7
2025-04-10ensure //@compile-flags are last even when passing --editionPietro Albini-2/+6
2025-04-10compiletest: update to Edition 2024Jieyou Xu-15/+44
2025-04-10compiletest: add `needs-crate-type` directiveJieyou Xu-2/+117
The `//@ needs-crate-type: $crate_types...` directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run.
2025-04-10compiletest: don't use stringly paths for `compose_and_run`Jieyou Xu-22/+23
2025-04-10Auto merge of #139279 - BoxyUwU:bump-boostrap, r=jieyouxubors-3/+0
Bump boostrap compiler to new beta try-job: `*msvc*`
2025-04-09Rollup merge of #139489 - petrochenkov:noreqann, r=jieyouxuMatthias Krüger-15/+41
compiletest: Add directive `dont-require-annotations` for making matching on specific diagnostic kinds non-exhaustive. E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR. cc https://github.com/rust-lang/rust/pull/139427#issuecomment-2782827583 Closes #132647 FYI `@BoxyUwU` since you've wanted this. r? `@jieyouxu`
2025-04-09update cfgsBoxy-3/+0
2025-04-09compiletest: Add directive `dont-require-annotations`Vadim Petrochenkov-15/+41
for making matching on specific diagnostic kinds non-exhaustive
2025-04-09Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgrbors-20/+15
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-08Rollup merge of #139528 - Zalathar:no-logfile, r=jieyouxuMatthias Krüger-6/+1
compiletest: Remove the `--logfile` flag This flag is deprecated in libtest (#134283), and there's no evidence in-tree of this flag actually being passed to compiletest. For detailed information about test results, bootstrap parses JSON output from compiletest instead (#108659). As part of my experimental work on removing the libtest dependency from compiletest, it's useful to be able to disconnect libtest functionality that isn't needed.
2025-04-08compiletest: Remove the `--logfile` flagZalathar-6/+1
This flag is deprecated in libtest, and there's no evidence in-tree of this flag actually being passed to compiletest. (For detailed information about test results, bootstrap parses JSON output from compiletest instead.)
2025-04-08compiletest: Trim whitespace from environment variable namesZalathar-16/+13
2025-04-08compiletest: drop dependency on `anyhow`Jieyou Xu-7/+5
Currently `compiletest` panics all over the place but doesn't really use `anyhow` anyway. I'd like to introduce some more principled error handling and disciplined diagnostic reporting in the near future.
2025-04-08compiletest: sort dependencies alphabeticallyJieyou Xu-8/+10
2025-04-07compiletest: Avoid ignoring empty diagnostics in one more placeVadim Petrochenkov-2/+1
This catches some silly notes emitted by rustc, which should ideally be fixed
2025-04-07compiletest: Stricter parsing for diagnostic kindsVadim Petrochenkov-35/+37
2025-04-07compiletest: Always preserve kind for compiler diagnosticsVadim Petrochenkov-22/+36
Those that didn't previously preserved kind are now marked as not requiring annotations to keep the previous behavior. Also, do not lose diagnostics with an empty message.
2025-04-07compiletest: Cleanup collection of actual errorsVadim Petrochenkov-48/+35
2025-04-04Rollup merge of #139317 - Zalathar:hide-libtest, r=jieyouxuMatthias Krüger-105/+208
compiletest: Encapsulate all of the code that touches libtest Compiletest currently relies on unstable libtest APIs in order to actually execute tests. That's unfortunate, but removing the dependency isn't trivial. However, we can make a small step towards removing the libtest dependency by encapsulating the libtest interactions into a single dedicated module. That makes it easier to see what parts of libtest are actually used. --- As a side-effect of moving the `test_opts` function into that dedicated module, this PR also ends up allowing `--fail-fast` to be passed on the command line, instead of requiring an environment variable. --- There is still (at least) one other aspect of the libtest dependency that this PR does not address, namely the fact that we rely on libtest's output capture (via unstable std APIs) to capture the output that we print during individual tests. I hope to do something about that at some point. r? jieyouxu
2025-04-03compiletest: Encapsulate all of the code that touches libtestZalathar-98/+194
2025-04-03compiletest: Allow `--fail-fast` as a command-line optionZalathar-8/+15
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-10/+6
2025-03-29Rollup merge of #139100 - petrochenkov:errbelow, r=jieyouxuMatthias Krüger-1/+7
compiletest: Support matching diagnostics on lines below Using `//~vvv ERROR`. This is not needed often, but it's easy to support, and it allows to eliminate a class of `error-pattern`s that cannot be eliminated in any other way. See the diff for the examples of such patterns coming from parser. Some of them can be matched by `//~ ERROR` or `//~^ ERROR` as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using `//~v ERROR`.
2025-03-29Rollup merge of #138692 - jieyouxu:reject-bool-lit-rev-names, r=wesleywiserMatthias Krüger-8/+35
Reject `{true,false}` as revision names Because they would imply `--cfg={true,false}` otherwise, and the test writer has to use `cfg(r#true)` and `cfg(r#false)` in the test. Closes #138663.
2025-03-29compiletest: Support matching diagnostics on lines belowVadim Petrochenkov-1/+7
2025-03-27Report compiletest pass mode if forcedJieyou Xu-12/+17
This is very non-obvious if it fails in PR CI.
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-76/+73
2025-03-23Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertionJieyou Xu-4/+5
2025-03-19Simplify `get_git_modified_files`Jakub Beránek-2/+1
It only ever returned `Some`, so `Option` was useless in its return type.
2025-03-19Reject `{true,false}` as revision namesJieyou Xu-8/+35
Because they would imply `--cfg={true,false}` otherwise, and the test writer has to use `cfg(r#true)` and `cfg(r#false)` in the test.
2025-03-17replace config.toml to bootstrap.toml in src:toolsbit-aloo-1/+1
2025-03-14Rollup merge of #138441 - tshepang:patch-5, r=jieyouxuJacob Pratt-1/+1
update error message [`compile-pass` has since been renamed to `build-pass`](https://github.com/rust-lang/rust/issues/62277)
2025-03-13update error messageTshepang Mbambo-1/+1
[`compile-pass` has since been renamed to `build-pass`](https://github.com/rust-lang/rust/issues/62277)
2025-03-11Update compiletest's `has_asm_support` to match rustcJosh Stone-1/+9
The list of `ASM_SUPPORTED_ARCHS` was missing a few from the compiler's actual stable list.
2025-03-07Rollup merge of #137537 - jieyouxu:daily-rmake, r=KobzolJacob Pratt-0/+5
Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do Addresses (mostly) #137532. Follow-up to #137373. ### Summary - Fix 3 run-make tests that currently use unstable features: 1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that. 2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic. 3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by #137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta. - Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`. - The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide. - This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could. r? `@Kobzol` try-job: x86_64-msvc-1 try-job: x86_64-mingw-1 [`os_pipe`]: https://github.com/oconnor663/os_pipe.rs [^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed. [^pipe-stab]: In-progress stabilization PR over at https://github.com/rust-lang/rust/pull/135822.
2025-03-07Prevent `rmake.rs` from using any nightly/unstable features许杰友 Jieyou Xu (Joe)-0/+5
2025-03-07Fix a typo in the crashtest output.Nicholas Nethercote-1/+1
2025-03-06Rollup merge of #138041 - ↵Michael Goulet-1/+0
thaliaarchi:use-prelude-size-of.boostrap-compiletest, r=jieyouxu bootstrap and compiletest: Use `size_of_val` from the prelude instead of imported Use `std::mem::size_of_val` from the prelude instead of importing or qualifying it. This function was added to all preludes in Rust 1.80. r? ``@jieyouxu``
2025-03-05bootstrap and compiletest: Use size_of_val from the prelude instead of importedThalia Archibald-1/+0
Use `std::mem::size_of_val` from the prelude instead of importing or qualifying it. This function was added to all preludes in Rust 1.80.
2025-03-05Rollup merge of #136865 - jieyouxu:long-type-path-compare-mode, r=lqd许杰友 Jieyou Xu (Joe)-2/+15
Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes Fixes #136510. ### Summary - Whereas previously `$TEST_BUILD_DIR` is a normalization of `/path/to/build/test/<test_suite_name>/`, we now more deeply normalize. `$TEST_BUILD_DIR` now becomes a normalization of `/path/to/build/test/<test_suite_name>/<subdirs>/$name.$revision.$compare_mode.$debugger/` to normalize away path name differences when `--compare-mode` and/or `--debugger` are specified. - We also centralize the normalization of long type name hashes cf. https://github.com/rust-lang/rust/pull/136328#discussion_r1936760908. ### Review advice - Best reviewed commit-by-commit. - Split into 3 commits: - **Commit 1**: compiletest changes to have `$TEST_BUILD_DIR` more deeply normalize. - **Commit 2**: remove per-test hacks for long type path hash normalizations, and rebless tests *specifically* affected by that. - **Commit 3**: rebless other tests that were changed as a side-effect of deeper `$TEST_BUILD_DIR` normalizations. **Commit 2** is created via first finding tests that try to perform long type file hash normalizations on an ad hoc, per-test basis: ``` rg --no-ignore -l --no-ignore -F -e "long-type" tests/ui/**/*.rs ``` <details> <summary>Tests with ad hoc long-type hash normalizations</summary> ``` tests/ui/type_length_limit.rs tests/ui/traits/on_unimplemented_long_types.rs tests/ui/regions/issue-102374.rs tests/ui/recursion/recursion.rs tests/ui/recursion/issue-83150.rs tests/ui/recursion/issue-23122-2.rs tests/ui/methods/inherent-bound-in-probe.rs tests/ui/issues/issue-67552.rs tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs tests/ui/issues/issue-20413.rs tests/ui/issues/issue-8727.rs tests/ui/infinite/infinite-instantiation.rs tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.rs tests/ui/error-codes/E0275.rs tests/ui/diagnostic-width/secondary-label-with-long-type.rs tests/ui/diagnostic-width/long-e0277.rs tests/ui/diagnostic-width/non-copy-type-moved.rs tests/ui/diagnostic-width/long-E0308.rs tests/ui/diagnostic-width/E0271.rs tests/ui/diagnostic-width/binop.rs ``` </details> These ad hoc normalizations were removed, and they are reblessed. r? `````@lqd`````
2025-03-05Rollup merge of #136581 - jieyouxu:makefile-be-gone, r=Kobzol许杰友 Jieyou Xu (Joe)-214/+18
Retire the legacy `Makefile`-based `run-make` test infra The final piece of [porting run-make tests to use Rust #121876](https://github.com/rust-lang/rust/issues/121876). Closes #121876. Closes #40713. Closes #81791 (no longer using `wc`). Closes #56475 (no longer a problem in current form of that test; we don't ignore the test on `aarch64-unknown-linux-gnu`). ### Summary This PR removes the legacy `Makefile`-based `run-make` test infra which has served us well over the years. The legacy infra is no longer needed since we ported all of `Makefile`-based `run-make` tests to the new `rmake.rs` infra. Additionally, this PR: - Removes `tests/run-make/tools.mk` since no more `Makefile`-based tests remain. - Updates `tests/run-make/README.md` and rustc-dev-guide docs to remove mention about `Makefile`-based `run-make` tests - Update test suite requirements in rustc-dev-guide on Windows to no longer need MSYS2 (they should also now run successfully on native Windows MSVC). - Update `triagebot.toml` to stop backlinking to #121876. **Thanks to everyone who helped in this effort to modernize the `run-make` test infra and test suite!** r? bootstrap
2025-03-04Rollup merge of #137373 - Kobzol:tool-stage0-improve, r=jieyouxuJubilee-78/+51
Compile run-make-support and run-make tests with the bootstrap compiler It does not seem necessary to have to recompile run-make-support on changes to the local compiler/stdlib. This PR simplifies the implementation of a few tools, then switches rms to stage0 and also makes the handling of environment variables in run-make tests simpler. Best reviewed commit-by-commit. I can split it into multiple PRs if you want. Also tested that `COMPILETEST_FORCE_STAGE0=1 ./x test tests/run-make --stage 0` still works. Incredibly, it looks like it even passes more tests than on `master` :laughing: r? ``@jieyouxu``
2025-03-04Auto merge of #135695 - Noratrieb:elf-raw-dylib, r=bjorn3bors-0/+12
Support raw-dylib link kind on ELF raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time. I was inspired by Björn's comments in https://internals.rust-lang.org/t/bundle-zig-cc-in-rustup-by-default/22096/27 Tracking issue: #135694 r? bjorn3 try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various