about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
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
2025-03-04compiletest: change `TEST_BUILD_DIR` to maximally normalize许杰友 Jieyou Xu (Joe)-2/+15
This is to make test stderr insensitive to compare-mode / debugger that changes the test build dir output name. Previously, this normalized paths up to test-suite-specific build root, e.g. `/path/to/build/test/ui/`. Now, this normalizes up to test-specific build root, e.g. `/path/to/build/test/ui/subdir/$name.$revision.$mode.$debugger/`.
2025-03-02compiletest: remove legacy `Makefile`-based `run-make` support许杰友 Jieyou Xu (Joe)-214/+18
2025-03-01Compile run-make recipes using the stage0 compilerJakub Beránek-78/+51
2025-02-27Rollup merge of #136542 - jieyouxu:build-base, r=onur-ozkanMatthias Krüger-38/+51
[`compiletest`-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing Reference for overall changes: https://github.com/rust-lang/rust/pull/136437 Part **4** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Remove `--build-base` compiletest flag, and introduce `--build-{root,test-suite-root}` flags instead. `--build-base` previously actually is test suite specific build directory, not the root `build/` directory. - Feed the root build directory directly from bootstrap to compiletest via `--build-root` instead of doing multiple layers of parent unwrapping[^parent] based on the test suite specific build directory. - Remove a redundant `to_path_buf()`. [^parent]: Please do not unwrap the parents. r? bootstrap
2025-02-26Support raw-dylib link kind on ELFNoratrieb-0/+12
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.
2025-02-23compiletest: disambiguate between root build dir vs test suite specific ↵许杰友 Jieyou Xu (Joe)-38/+51
build dir - Introduce and use `--build-{root,test-suite-root}` over `--build-base`. - A few minor cleanups.
2025-02-23Auto merge of #137237 - cuviper:stage0, r=Mark-Simulacrumbors-2/+0
Master bootstrap update https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday r? `@Mark-Simulacrum`
2025-02-22compiletest: introduce and use `--src-root` and `--src-test-suite-root`许杰友 Jieyou Xu (Joe)-97/+74
Instead of only having `--src-base` and `src_base` which *actually* refers to the directory containing the test suite and not the sources root. More importantly, kill off `find_rust_src_root` when we can simply pass that info from bootstrap.
2025-02-19Create a generic AVR target: avr-nonePatryk Wychowaniec-0/+3
This commit removes the `avr-unknown-gnu-atmega328` target and replaces it with a more generic `avr-none` variant that must be specialized with the `-C target-cpu` flag (e.g. `-C target-cpu=atmega328p`).
2025-02-18update `cfg(bootstrap)`Josh Stone-2/+0
2025-02-15compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives许杰友 Jieyou Xu (Joe)-1/+36
2025-02-10Rollup merge of #136472 - jieyouxu:pass-stage, r=Mark-SimulacrumJubilee-30/+28
[`compiletest`-related cleanups 2/7] Feed stage number to compiletest directly Reference for overall changes: https://github.com/rust-lang/rust/pull/136437 Part **2** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Pass stage number via new `--stage` compiletest flag directly from bootstrap, instead of deriving that info in compiletest by doing gymnastics on `--stage-id`. - Just a cleanup, should have no functional changes. r? bootstrap
2025-02-08Rustfmtbjorn3-3/+4
2025-02-03Rollup merge of #136441 - jieyouxu:cleanup-is-rustdoc, r=compiler-errors许杰友 Jieyou Xu (Joe)-5/+2
[`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic Reference for overall changes: https://github.com/rust-lang/rust/pull/136437 Part **1** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Don't match on path when we already have test suite names. - Remove a useless path join. r? bootstrap (or compiler)
2025-02-03compiletest: use `--stage` number directly instead of deriving from `--stage-id`许杰友 Jieyou Xu (Joe)-30/+28
Notably, this avoids having to do hacky string splitting based on `--stage-id`.
2025-02-03Remove a footgun-y feature / relic of the past from the compiletest DSLLeón Orell Valerian Liehr-8/+0
2025-02-02compiletest: remove useless path join in `rustdoc_json` runtest logic许杰友 Jieyou Xu (Joe)-2/+1
2025-02-02compiletest: cleanup `is_rustdoc` logic许杰友 Jieyou Xu (Joe)-3/+1
2025-01-31CompileTest: Add Directives to Ignore `arm-unknown-*` TestsVeera-0/+4
2025-01-28Fix tests/codegen/float/f128Alisa Sireneva-0/+1
2025-01-25Shorten linker output even more when `--verbose` is not presentjyn-0/+2
- Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long. - For .rlibs in the sysroot, replace crate hashes with a `"-*"` string. This will expand to the full crate name when pasted into the shell. - Move `.rlib` to outside the glob. - Abbreviate the sysroot path to `<sysroot>` wherever it appears in the arguments. This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests. - Only use linker-flavor=gnu-cc if we're actually going to compare the output. It doesn't exist on MacOS.
2025-01-23compiletest: implement `needs-subprocess` directive许杰友 Jieyou Xu (Joe)-0/+20
2025-01-23Auto merge of #135164 - Kobzol:run-make-test-glibc-symbols, r=jieyouxubors-0/+7
Add test for checking used glibc symbols This test checks that we do not use too new glibc symbols in the compiler on x64 GNU Linux, in order not to break our [glibc promises](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html). One thing that isn't solved in the PR yet is to make sure that this test will only run on `dist` CI, more specifically on the `dist-x86_64-linux` runner, in the opt-dist post-optimization tests (it can fail elsewhere, that doesn't matter). Any suggestions on how to do that are welcome. Fixes: https://github.com/rust-lang/rust/issues/134037 r? `@jieyouxu`
2025-01-22Rollup merge of #135557 - estebank:wtf8, r=fee1-deadMatthias Krüger-0/+2
Point at invalid utf-8 span on user's source code ``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: byte `193` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-22Run the glibc run-make test in opt-distJakub Beránek-1/+1
2025-01-22Point at invalid utf-8 span on user's source codeEsteban Küber-0/+2
``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `[193]` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-21bumpt compiler and tools to windows 0.59klensy-3/+2
2025-01-21Add test for checking used glibc symbolsJakub Beránek-1/+8
2025-01-18Rollup merge of #135421 - cod10129:warn-tidy-ignore, r=onur-ozkanMatthias Krüger-2/+2
Make tidy warn on unrecognized directives This PR makes it so tidy warns on unrecognized directives, as recommended on [the discussion of #130984](https://github.com/rust-lang/rust/issues/130984#issuecomment-2589284620). This is edited from the previous version of this PR, which only warned on "tidy-ignore" and no other tidy directive typos. Fixes #130984. ``@rustbot`` label A-tidy C-enhancement
2025-01-14add tidy warning for unrecognized directivescod10129-2/+2
This makes tidy warn on the presence of any directives it does not recognize. There are changes in compiletest because that file used "tidy-alphabet" instead of "tidy-alphabetical".