about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2024-12-12Revert "Rollup merge of #134040 - clubby789:bootstrap-eprintln, r=jieyouxu"许杰友 Jieyou Xu (Joe)-57/+57
This reverts commit b282774aaf0aa05b4a9855d973b67e7e424c2136, reversing changes made to e0f3db0056288a06b1ae36cdd70741a4e0b3584a.
2024-12-09compiletest: `print{,ln}!` -> `eprint{,ln}!`clubby789-57/+57
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-12-09Auto merge of #134052 - matthiaskrgr:rollup-puxwqrk, r=matthiaskrgrbors-5/+12
Rollup of 7 pull requests Successful merges: - #133567 (A bunch of cleanups) - #133789 (Add doc alias 'then_with' for `then` method on `bool`) - #133880 (Expand home_dir docs) - #134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible) - #134045 (Fix some triagebot mentions paths) - #134046 (Remove ignored tests for hangs w/ new solver) - #134050 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-08improve `--compare-mode` error handlingRémy Rakic-5/+12
- show the erroneous value - show the valid values
2024-12-07compiletest: show the difference between the normalized output and the ↵jyn-35/+119
actual output for lines which didn't match example output: ``` failures: ---- [ui] tests/ui/layout/enum.rs stdout ---- diff of stderr: - error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN } + error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN } 2 --> $DIR/enum.rs:9:1 3 | 4 LL | enum UninhabitedVariantAlign { Note: some mismatched output was normalized before being compared - error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: Align(8 bytes) } - --> /home/jyn/src/rust2/tests/ui/layout/enum.rs:9:1 + error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIN } ```
2024-12-05Revert "Rollup merge of #133817 - clubby789:bootstrap-eprintln, r=jieyouxu"Jieyou Xu-54/+54
This reverts commit 0585134e709de4a14e509158662fa569c155c195, reversing changes made to 5530869e0ff21d69e0eef1a4c4fd1f25bcbe7fbf. The PR unfortunately only converted the `ln!` instances, meaning that test output was messed up because stdout/stderr output interleaved when some `println!` instances were converted to `eprintln!` instances, while some `println!` instances remain unchanged.
2024-12-04Rollup merge of #133817 - clubby789:bootstrap-eprintln, r=jieyouxuMatthias Krüger-54/+54
Use `eprintln` instead of `println` in bootstrap/compiletest/tidy A big unconditional CTRL-F replace to start with to check if there's anything that CI expects to be on stdout r? `@jieyouxu`
2024-12-03compiletest: `println!` -> `eprintln!`clubby789-54/+54
2024-12-03compiletest: explain that UI tests are expected not to compile by defaultclubby789-4/+7
2024-12-02Rollup merge of #133710 - Urgau:target_feature-merge-conflitcs, r=jieyouxuGuillaume Gomez-0/+2
Reducing `target_feature` check-cfg merge conflicts It was rightfully pointed in https://github.com/rust-lang/rust/pull/133099#discussion_r1862490542 that the expected values for the `target_feature` cfg are regularly updated and unfortunately the check-cfg tests for it are very merge-conflict prone. This PR aims at drastically reducing the likely-hood of those, by normalizing the "and X more" diagnostic, as well as making the full expected list multi-line instead of being on a single one. cc `@RalfJung` r? `@jieyouxu`
2024-12-02Rollup merge of #133736 - jieyouxu:needs-target-has-atomic, r=compiler-errorsGuillaume Gomez-5/+106
Add `needs-target-has-atomic` directive Before this PR, the test writer has to specify platforms and architectures by hand for targets that have differing atomic width support. `#[cfg(target_has_atomic="...")]` is not quite the same because (1) you may have to specify additional matchers manually which has to be maintained individually, and (2) the `#[cfg]` blocks does not communicate to compiletest that a test would be ignored for a given target. This PR implements a `//@ needs-target-has-atomic` directive which admits a comma-separated list of required atomic widths that the target must satisfy in order for the test to run. ``` //@ needs-target-has-atomic: 8, 16, ptr ``` See <https://github.com/rust-lang/rust/issues/87377>. This PR supersedes #133095 and is co-authored by `@kei519,` because it was somewhat subtle, and it turned out easier to implement than to review. rustc-dev-guide docs PR: https://github.com/rust-lang/rustc-dev-guide/pull/2154
2024-12-02Add `needs-target-has-atomic` directive许杰友 Jieyou Xu (Joe)-5/+106
Before this commit, the test writer has to specify platforms and architectures by hand for targets that have differing atomic width support. `#[cfg(target_has_atomic)]` is not quite the same because (1) you may have to specify additional matchers manually which has to be maintained individually, and (2) the `#[cfg]` blocks does not communicate to compiletest that a test would be ignored for a given target. This commit implements a `//@ needs-target-has-atomic` directive which admits a comma-separated list of required atomic widths that the target must satisfy in order for the test to run. ``` //@ needs-target-has-atomic: 8, 16, ptr ``` See <https://github.com/rust-lang/rust/issues/87377>. Co-authored-by: kei519 <masaki.keigo.q00@kyoto-u.jp>
2024-12-01Remove `//@ compare-output-lines-by-subset`jyn-18/+4
There was only ever one test which used this flag, and it was removed in https://github.com/rust-lang/rust/pull/132244. I think this is a bad flag that should never have been added; comparing by subset makes the test failures extremely hard to debug. Any test that needs complicated output filtering like this should just use run-make instead. Note that this does not remove the underlying comparison code, because it's still used if `runner` is set. I don't quite understand what's going on there, but since we still test on other platforms and in CI that the full output is accurate, I think it will be easier to debug than a test that uses compare-by-subset unconditionally.
2024-12-01compiletest: un-escape new-line in normalize replacement stringUrgau-0/+2
2024-11-27Compiletest: Add proc-macro headerEric Huss-23/+66
This adds a proc-macro header to make it easier to depend on a proc-macro, and remove some of the boilerplate necessary.
2024-11-26compiletest: remove `pretty-expanded` directive and infraJieyou Xu-22/+0
Foreword ======== Let us begin the journey to rediscover what the `//@ pretty-expanded` directive does, brave traveller -- "My good friend, [..] when I wrote that passage, God and I knew what it meant. It is possible that God knows it still; but as for me, I have totally forgotten." -- Johann Paul Friedrich Richter, 1826 We must retrace the steps of those before us, for history shall guide us in the present and inform us of the future. The Past ======== Originally there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features #23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME #23616` linking to [There are very few tests for `-Z unpretty` expansion #23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in <https://github.com/rust-lang/rust/issues/23616#issuecomment-484999901>: The attribute is off by default and things just work if you don't test it, people have not been adding the `pretty-expanded` annotation to new tests even if it would work. Which basically renders this useless. The Present =========== As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all of the `//@ pretty-expanded` in `ui` tests to do absolutely nothing -- the compiletest logic for `pretty-expanded` only triggered in the *pretty* test suite, but none of the pretty tests use it. Oops. The Future ========== Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether. [pr-23598]: https://github.com/rust-lang/rust/pull/23598 [issue-23616]: https://github.com/rust-lang/rust/issues/23616
2024-11-14compiletest: add `max-llvm-major-version` directive许杰友 Jieyou Xu (Joe)-0/+24
There's already `min-llvm-version`, and contributors were using `ignore-llvm-version: 20 - 99` to emulate `max-llvm-major-version: 19`.
2024-11-13Address reviewKirill Podoprigora-3/+9
2024-11-13Add ``exact-llvm-major-version`` directiveKirill Podoprigora-0/+23
2024-11-12Rollup merge of #132657 - mustartt:aix-run-make-support, r=jieyouxuMatthias Krüger-0/+1
AIX: add run-make support On AIX, we are required explicit link against `c++` and `c++abi` to support running the run-make test suite.
2024-11-11move `src/tools/build_helper` into `src/build_helper`onur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-07Rollup merge of #131913 - jieyouxu:only_debug_assertions, r=onur-ozkanJubilee-9/+77
Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support Add `{ignore,needs}-{rustc,std}-debug-assertions` compiletest directives and retire the old `{ignore,only}-debug` directives. The old `{ignore,only}-debug` directives were ambiguous because you could have std built with debug assertions but rustc not built with debug assertions or vice versa. If we want to support the use case of controlling test run based on if rustc was built with debug assertions, then having `{ignore,only}-debug` will be very confusing. cc ````@matthiaskrgr```` Closes #123987. r? bootstrap (or compiler tbh)
2024-11-05add run-make support for aixHenry Jiang-0/+1
2024-11-03Remove the `wasm32-wasi` target from rustcAlex Crichton-4/+0
This commit is the final step in the journey of renaming the historical `wasm32-wasi` target in the Rust compiler to `wasm32-wasip1`. Various steps in this journey so far have been: * 2023-04-03: rust-lang/compiler-team#607 - initial proposal for this rename * 2024-11-27: rust-lang/compiler-team#695 - amended schedule/procedure for rename * 2024-01-29: rust-lang/rust#120468 - initial introduction of `wasm32-wasip1` * 2024-06-18: rust-lang/rust#126662 - warn on usage of `wasm32-wasi` * 2024-11-08: this PR - remove the `wasm32-wasi` target The full transition schedule is in [this comment][comment] and is summarized with: * 2024-05-02: Rust 1.78 released with `wasm32-wasip1` target * 2024-09-05: Rust 1.81 released warning on usage of `wasm32-wasi` * 2025-01-09: Rust 1.84 to be released without the `wasm32-wasi` target This means that support on stable for the replacement target of `wasm32-wasip1` has currently been available for 6 months. Users have already seen warnings on stable for 2 months about usage of `wasm32-wasi` and stable users have another 2 months of warnings before the target is removed from stable. This commit is intended to be the final step in this transition so the source tree should no longer mention `wasm32-wasi` except in historical reference to the older name of the `wasm32-wasip1` target. [comment]: https://github.com/rust-lang/rust/pull/120468#issuecomment-1977878747
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-5/+5
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-10-31compiletest: stamp `minicore.rs` to rerun tests on changes许杰友 Jieyou Xu (Joe)-0/+6
2024-10-31compiletest: conditionally build and provide `minicore` as extern prelude ↵许杰友 Jieyou Xu (Joe)-2/+48
when requested via `//@ add-core-stubs` directive `//@ add-core-stubs` will imply `-Cpanic=abort`.
2024-10-31compiletest: register `--minicore-path` flag and `//@ add-core-stubs` directive许杰友 Jieyou Xu (Joe)-1/+41
2024-10-31compiletest: localize `compile_test_and_save_assembly` to assembly test module许杰友 Jieyou Xu (Joe)-29/+31
2024-10-31compiletest: add `{ignore,needs}-{rustc,std}-debug-assertions` directive support许杰友 Jieyou Xu (Joe)-9/+77
And retire the old `only-debug` directive which was ambiguous and only for std debug assertions.
2024-10-30compiletest: improve robustness of LLVM version handling许杰友 Jieyou Xu (Joe)-70/+139
2024-10-29Rename `command-list.rs` to `directive-list.rs`Zalathar-2/+2
2024-10-28Auto merge of #132244 - jyn514:linker-refactors, r=bjorn3bors-1/+9
fix various linker warnings separated out from https://github.com/rust-lang/rust/pull/119286; this doesn't have anything user-facing, i just want to land these changes so i can stop rebasing them. r? `@bjorn3`
2024-10-27don't pass `-L .../auxiliary` unless it existsjyn-1/+9
this avoids warnings from macOS ld
2024-10-27Dynamically link run-make supportclubby789-0/+1
2024-10-24Rollup merge of #132093 - jieyouxu:suppress-wer, r=onur-ozkanJubilee-9/+17
compiletest: suppress Windows Error Reporting (WER) for `run-make` tests WER by default will show a *bunch* of error dialogues for missing DLLs on Windows for `run-make` tests. We address that by: 1. Guarding `run-make` test process spawning with `disable_error_reporting`. 2. Fixing `disable_error_reporting` to also add the [`SEM_FAILCRITICALERRORS` flag to `SetErrorMode`][SetErrorMode]. Just `SEM_NOGPFAULTERRORBOX` was not sufficient to suppress error dialogues for e.g. missing DLLs. Fixes #132092. In particular, refer to that issue for the necessary conditions to observe these dialogues from popping up in the first place. I was only able to manually test this locally in my "native" Windows msvc environment and it prevents the WER dialogues from popping up, I don't think it's possible to really test this automatically. [SetErrorMode]: https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode?redirectedfrom=MSDN#parameters
2024-10-24Rollup merge of #131930 - clubby789:revision-cfg-collide, r=jieyouxuStuart Cook-0/+22
Don't allow test revisions that conflict with built in cfgs Fixes #128964 Sorry `@heysujal` I started working on this about 1 minute before your comment by complete coincidence 😅
2024-10-24compiletest: suppress Windows Error Reporting (WER) for `run-make` tests许杰友 Jieyou Xu (Joe)-9/+17
2024-10-23Don't allow test revisions that conflict with built in cfgsclubby789-0/+22
2024-10-23Rollup merge of #131181 - dev-ardi:custom-differ, r=jieyouxuLeón Orell Valerian Liehr-37/+57
Compiletest: Custom differ This adds support for a custom differ for compiletests. It’s purely visual and helps produce cleaner output when UI tests fail. I’m using an environment variable for now since it’s experimental and I don’t want to drill the cli arguments all the way down. Also did a bit of general cleanup while I was at it. This is how it looks [with debug info silenced](https://github.com/rust-lang/rust/pull/131182) (#131182) `COMPILETEST_DIFF_TOOL="/usr/bin/env difft --color always --background light --display side-by-side" ./x test tests/ui/parser` ![image](https://github.com/user-attachments/assets/f740ce50-7564-4469-be0a-86e24bc50eb8)
2024-10-22s/display-diff-tool/compiletest-diff-tool/Orion Gonzalez-2/+3
2024-10-22update CONFIG_CHANGE_HISTORYOrion Gonzalez-3/+7
2024-10-22implemented custom differOrion Gonzalez-39/+51
2024-10-22add an option for a custom differOrion Gonzalez-0/+3
2024-10-22Make `line_directive` return a `DirectiveLine`Zalathar-15/+20
This reduces the need to juggle raw tuples, and opens up the possibility of moving more parts of directive parsing into `line_directive`.
2024-10-22Rename some fields of `DirectiveLine`Zalathar-23/+27
2024-10-22Stop using `line_directive` in `runtest::debugger`Zalathar-30/+12
This also removes unused support for `[rev]` in debugger commands, and makes breakpoint detection slightly more sensible.
2024-10-20compiletest: disambiguate between `tidy` and `tidy` (html version)许杰友 Jieyou Xu (Joe)-9/+7
2024-10-20Rollup merge of #131941 - lolbinarycat:compiletest-need-html-tidy, r=clubby789Stuart Cook-1/+1
compiletest: disambiguate html-tidy from rust tidy tool when i first saw this error message i was very confused, i thought it was talking about `src/tools/tidy`. now it should be much more clear what tool should be installed.
2024-10-19compiletest: disambiguate html-tidy from rust tidy toolbinarycat-1/+1