about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
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
2024-10-19Warn on redundant `--cfg` directive when revisions are usedclubby789-1/+13
2024-10-18Rename `stamp` to `stamp_file_path`Zalathar-7/+7
2024-10-18Rename `found_paths` to `found_path_stems`Zalathar-8/+8
2024-10-18Rename `inputs` to `common_inputs_stamp`Zalathar-7/+13
The new name makes it clearer that this is a timestamp, and is collected from input files considered common to all tests.
2024-10-18Store test collection context/state in two structsZalathar-86/+73
2024-10-18Consolidate test collection state in one placeZalathar-11/+12
2024-10-16Fix unnecessary nesting in run-make test output directoriesZalathar-1/+5
2024-10-15Rollup merge of #131705 - hoodmane:fix-emscripten-tests, r=jieyouxuMichael Goulet-1/+3
Fix most ui tests on emscripten target To fix the linker errors, we need to set the output extension to `.js` instead of `.wasm`. Setting the output to a `.wasm` file puts Emscripten into standalone mode which is effectively a distinct target. We need to set the runner to be `node` as well. This fixes most of the ui tests. I fixed 4 additional tests with simple problems: - `intrinsics/intrinsic-alignment.rs` -- Two `#[cfg]` macros match for Emscripten so we got duplicate definition - `structs-enums/rec-align-u64.rs` -- same problem - `issues/issue-12699.rs` -- hangs so I disabled it - `process/process-sigpipe.rs` -- Not expected to work on Emscripten so I disabled it Resolves #131666. There are 7 more failing tests. I'll try to investigate more and see if I can fix them or at least understand why they happen. - abi/numbers-arithmetic/return-float.rs (problem with [wasm treatment of noncanonical floats](https://webassembly.github.io/spec/core/exec/numerics.html#nan-propagation)?) - async-await/issue-60709.rs -- linker error related to memcpy. Possible Emscripten bug? - backtrace/dylib-dep.rs -- Says "Not supported" - backtrace/line-tables-only.rs -- Says "Not supported" - no_std/no-std-unwind-binary.rs -- compiler says `error: lang item required, but not found: eh_catch_typeinfo` - structs-enums/enum-rec/issue-17431-6.rs -- One of the two compiler errors is missing - test-attrs/test-passed.rs r?workingjubilee r?jieyouxu
2024-10-15Fix most ui tests on emscripten targetHood Chatham-1/+3
To fix the linker errors, we need to set the output extension to `.js` instead of `.wasm`. Setting the output to a `.wasm` file puts Emscripten into standalone mode which is effectively a distinct target. We need to set the runner to be `node` as well. This fixes most of the ui tests. I fixed a few more tests with simple problems: - `intrinsics/intrinsic-alignment.rs` and `structs-enums/rec-align-u64.rs` -- Two `#[cfg]` macros match for Emscripten so we got a duplicate definition of `mod m`. - `issues/issue-12699.rs` -- Seems to hang so I disabled it - `process/process-sigpipe.rs` -- Not expected to work on Emscripten so I disabled it
2024-10-15Rollup merge of #131681 - Zalathar:fix-run-make-stamp, r=jieyouxuMatthias Krüger-8/+2
Fix up-to-date checking for run-make tests This special case in `output_base_dir` had the unfortunate side-effect of causing all run-make tests to share the same `stamp` file. So as soon as any one of them succeeded, all of the failed tests would be incorrectly considered up-to-date and would no longer run in subsequent test invocations. Fixes #129971. r? jieyouxu
2024-10-14Fix up-to-date checking for run-make testsZalathar-8/+2
This special case in `output_base_dir` had the unfortunate side-effect of causing all run-make tests to share the same `stamp` file. So as soon as any one of them succeeded, all of the failed tests would be considered up-to-date and would no longer run in subsequent test invocations.