about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2022-08-07compiletest: match ignores on target familyEric Huss-0/+29
This primarily is so that `ignore-wasm` works as expected (ignores all wasm-like targets).
2022-08-07compiletest: use precise cfg matching instead of hard-coded tablesEric Huss-208/+301
2022-07-28Use line numbers relative to function in mir opt testsNilstrieb-0/+1
This adds a new option, `-Zmir-pretty-relative-line-numbers`, that is then used in compiletest for the mir-opt tests.
2022-07-24Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisabors-0/+19
Add fine-grained LLVM CFI support to the Rust compiler This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-23Auto merge of #98208 - ivanloz:master, r=nagisabors-0/+5
Add support for LLVM ShadowCallStack. LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address. LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs. # Usage `-Zsanitizer=shadow-call-stack` # Comments/Caveats * Currently only enabled for the aarch64-linux-android target * Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-23Add fine-grained LLVM CFI support to the Rust compilerRamon de C Valle-0/+19
This commit improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2022-07-20Add ShadowCallStack SupportIvan Lozano-0/+5
Adds support for the LLVM ShadowCallStack sanitizer.
2022-07-20compiletest: dedup revision line logic.Luqman Aden-31/+27
2022-07-20compiletest: allow using revisions with debuginfo testsLuqman Aden-13/+47
2022-07-12Add regex-error-pattern flag in compiletestGuillaume Gomez-19/+66
2022-07-11compiletest: trim edition before passing as flagDeadbeef-1/+1
This makes `edition: 2021` work instead of the ugly `edition:2021` one has to write.
2022-07-04Auto merge of #98817 - the8472:dont-optimize-ui-tests, r=Mark-Simulacrumbors-0/+32
Only obey optimize-tests flag on UI tests that are run-pass stage1 UI tests walltime on my machine: ``` optimize-tests = false, master 25.98s optimize-tests = true, master 34.69s optimize-tests = true, patched 28.79s ``` Effects: - faster UI tests - llvm asserts get exercised less on build-pass tests - the difference between opt and nopt builds shrinks a bit - aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags
2022-07-02move optimize-tests flag handling from bootstrap to compiletestThe 8472-16/+28
2022-07-02Only obey optimize-tests flag on UI tests that are run-passThe 8472-0/+20
``` optimize-tests = false, master 25.98s optimize-tests = true, master 34.69s optimize-tests = true, patched 28.79s ``` Effects: - faster UI tests - llvm asserts get exercised less on build-pass tests - the difference between opt and nopt builds shrinks a bit - aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags
2022-07-02Fix bug in `rustdoc -Whelp`Joshua Nelson-2/+4
Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints - Remove duplicate run-make test
2022-06-28Rollup merge of #98564 - jyn514:remove-tmp-dir, r=Mark-SimulacrumMatthias Krüger-5/+0
Remove references to `./tmp` in-tree These used to be used by codegen-units tests, but were switched from manually specifying directories to just using `// incremental` in https://github.com/rust-lang/rust/pull/89101. Remove the old references. Fixes https://github.com/rust-lang/rust/issues/34586.
2022-06-26Remove references to `./tmp` in-treeJoshua Nelson-5/+0
These used to be used by codegen-units tests, but were switched from manually specifying directories to just using `// incremental` in https://github.com/rust-lang/rust/pull/89101. Remove the old references.
2022-06-26compiletest: add issue number param to `known-bug`David Knaack-1/+23
2022-06-22use `-Cstrip=debuginfo` with ui tests to reduce disk space usageklensy-0/+2
2022-06-13Add Apple WatchOS compile targetsVladimir Michael Eatwell-1/+2
2022-06-08Fix polonius compare mode.Eric Huss-1/+1
2022-06-07Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakisbors-15/+2
Remove migrate borrowck mode Closes #58781 Closes #43234 # Stabilization proposal This PR proposes the stabilization of `#![feature(nll)]` and the removal of `-Z borrowck`. Current borrow checking behavior of item bodies is currently done by first infering regions *lexically* and reporting any errors during HIR type checking. If there *are* any errors, then MIR borrowck (NLL) never occurs. If there *aren't* any errors, then MIR borrowck happens and any errors there would be reported. This PR removes the lexical region check of item bodies entirely and only uses MIR borrowck. Because MIR borrowck could never *not* be run for a compiled program, this should not break any programs. It does, however, change diagnostics significantly and allows a slightly larger set of programs to compile. Tracking issue: #43234 RFC: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md Version: 1.63 (2022-06-30 => beta, 2022-08-11 => stable). ## Motivation Over time, the Rust borrow checker has become "smarter" and thus allowed more programs to compile. There have been three different implementations: AST borrowck, MIR borrowck, and polonius (well, in progress). Additionally, there is the "lexical region resolver", which (roughly) solves the constraints generated through HIR typeck. It is not a full borrow checker, but does emit some errors. The AST borrowck was the original implementation of the borrow checker and was part of the initially stabilized Rust 1.0. In mid 2017, work began to implement the current MIR borrow checker and that effort ompleted by the end of 2017, for the most part. During 2018, efforts were made to migrate away from the AST borrow checker to the MIR borrow checker - eventually culminating into "migrate" mode - where HIR typeck with lexical region resolving following by MIR borrow checking - being active by default in the 2018 edition. In early 2019, migrate mode was turned on by default in the 2015 edition as well, but with MIR borrowck errors emitted as warnings. By late 2019, these warnings were upgraded to full errors. This was followed by the complete removal of the AST borrow checker. In the period since, various errors emitted by the MIR borrow checker have been improved to the point that they are mostly the same or better than those emitted by the lexical region resolver. While there do remain some degradations in errors (tracked under the [NLL-diagnostics tag](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-diagnostics), those are sufficiently small and rare enough that increased flexibility of MIR borrow check-only is now a worthwhile tradeoff. ## What is stabilized As said previously, this does not fundamentally change the landscape of accepted programs. However, there are a [few](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-fixed-by-NLL) cases where programs can compile under `feature(nll)`, but not otherwise. There are two notable patterns that are "fixed" by this stabilization. First, the `scoped_threads` feature, which is a continutation of a pre-1.0 API, can sometimes emit a [weird lifetime error](https://github.com/rust-lang/rust/issues/95527) without NLL. Second, actually seen in the standard library. In the `Extend` impl for `HashMap`, there is an implied bound of `K: 'a` that is available with NLL on but not without - this is utilized in the impl. As mentioned before, there are a large number of diagnostic differences. Most of them are better, but some are worse. None are serious or happen often enough to need to block this PR. The biggest change is the loss of error code for a number of lifetime errors in favor of more general "lifetime may not live long enough" error. While this may *seem* bad, the former error codes were just attempts to somewhat-arbitrarily bin together lifetime errors of the same type; however, on paper, they end up being roughly the same with roughly the same kinds of solutions. ## What isn't stabilized This PR does not completely remove the lexical region resolver. In the future, it may be possible to remove that (while still keeping HIR typeck) or to remove it together with HIR typeck. ## Tests Many test outputs get updated by this PR. However, there are number of tests specifically geared towards NLL under `src/test/ui/nll` ## History * On 2017-07-14, [tracking issue opened](https://github.com/rust-lang/rust/issues/43234) * On 2017-07-20, [initial empty MIR pass added](https://github.com/rust-lang/rust/pull/43271) * On 2017-08-29, [RFC opened](https://github.com/rust-lang/rfcs/pull/2094) * On 2017-11-16, [Integrate MIR type-checker with NLL](https://github.com/rust-lang/rust/pull/45825) * On 2017-12-20, [NLL feature complete](https://github.com/rust-lang/rust/pull/46862) * On 2018-07-07, [Don't run AST borrowck on mir mode](https://github.com/rust-lang/rust/pull/52083) * On 2018-07-27, [Add migrate mode](https://github.com/rust-lang/rust/pull/52681) * On 2019-04-22, [Enable migrate mode on 2015 edition](https://github.com/rust-lang/rust/pull/59114) * On 2019-08-26, [Don't downgrade errors on 2015 edition](https://github.com/rust-lang/rust/pull/64221) * On 2019-08-27, [Remove AST borrowck](https://github.com/rust-lang/rust/pull/64790)
2022-06-06Auto merge of #96551 - ferrocene:pa-ignore-paths-when-abbreviating, ↵bors-60/+249
r=Mark-Simulacrum [compiletest] Ignore known paths when abbreviating output To prevent out of memory conditions, compiletest limits the amount of output a test can generate, abbreviating it if the test emits more than a threshold. While the behavior is desirable, it also causes some issues (like #96229, #94322 and #92211). The latest one happened recently, when the `src/test/ui/numeric/numeric-cast.rs` test started to fail on systems where the path of the rust-lang/rust checkout is too long. This includes my own development machine and [LLVM's CI](https://github.com/rust-lang/rust/issues/96362#issuecomment-1108609893). Rust's CI uses a pretty short directory name for the checkout, which hides these sort of problems until someone runs the test suite on their own computer. When developing the fix I tried to find the most targeted fix that would prevent this class of failures from happening in the future, deferring the decision on if/how to redesign abbreviation to a later date. The solution I came up with was to ignore known base paths when calculating whether the output exceeds the abbreviation threshold, which removes this kind of nondeterminism. This PR is best reviewed commit-by-commit.
2022-06-04update testsPietro Albini-20/+20
2022-06-04address review commentsPietro Albini-24/+35
2022-06-03Fully stabilize NLLJack Huey-15/+2
2022-05-24Add support for embedding pretty printers via the `#[debugger_visualizer]` ↵ridwanabdillahi-0/+10
attribute. Add tests for embedding pretty printers and update documentation. Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run. Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section. Respond to PR comments and update documentation.
2022-05-22Disallow non-same compare-mode-nllJack Huey-18/+44
2022-05-13Auto merge of #96493 - chbaker0:issue-96342-fix, r=Mark-Simulacrumbors-1/+9
Add compiletest and bootstrap "--skip" option forwarded to libtest With this PR, "x.py test --skip SKIP ..." will run the specified test suite, but forward "--skip SKIP" to the test tool. libtest already supports this option. The PR also adds it to compiletest which itself just forwards it to libtest. Adds the functionality requested in https://github.com/rust-lang/rust/issues/96342. This is useful to work around tests broken upstream. https://github.com/rust-lang/rust/issues/96362#issuecomment-1108609893 is the specific test issue my project is trying to work around.
2022-05-12compiletest: normalize paths from repository rootDavid Wood-10/+9
When testing macros from `rustc_macros` in `ui-fulldeps` tests, sometimes paths from the compiler source tree can be shown in error messages - these need to be normalized. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-10Add test skip supportCollin Baker-1/+9
libtest already supports a "--skip SUBSTRING" arg which excludes any test names matching SUBSTRING. This adds a "--skip" argument to compiletest and bootstrap which is forwarded to libtest.
2022-05-02add testsPietro Albini-0/+126
2022-05-02fix existing bug when the first write was always included in fullPietro Albini-1/+2
2022-05-02extract ProcOutput out of the function to make it testablePietro Albini-82/+84
2022-05-02handle excluded strings across boundariesPietro Albini-1/+5
2022-04-29handle compiler emitting only excluded stringsPietro Albini-3/+9
2022-04-29ignore known paths when deciding whether to abbreviate the outputPietro Albini-15/+54
2022-04-28extract code to detect files related to a test into a different functionPietro Albini-11/+35
2022-04-27compiletest: add support for unused extern notificationsJeremy Fitzhardinge-0/+11
As generated by --json unused-externs.
2022-04-25Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisaMatthias Krüger-1/+12
Implement MIR opt unit tests This implements rust-lang/compiler-team#502 . There's not much to say here, this implementation does everything as proposed. I also added the flag to a bunch of existing tests (mostly those to which I could add it without causing huge diffs due to changes in line numbers). Summarizing the changes to test outputs: - Every time an `MirPatch` is created, it adds a cleanup block to the body if it did not exist already. If this block is unused (as is usually the case), it usually gets removed soon after by some pass calling `SimplifyCFG` for unrelated reasons (in many cases this cycle happens quite a few times for a single body). We now run `SimplifyCFG` less often, so those blocks end up in some of our outputs. I looked at changing `MirPatch` to not do this, but that seemed too complicated for this PR. I may still do that in a follow-up. - The `InstCombine` test had set `-C opt-level=0` in its flags and so there were no storage markers. I don't really see a good motivation for doing this, so bringing it back in line with what everything else does seems correct. - One of the `EarlyOtherwiseBranch` tests had `UnreachableProp` running on it. Preventing that kind of thing is the goal of this feature, so this seems fine. For the remaining tests for which this feature might be useful, we can gradually migrate them as opportunities present themselves. In terms of documentation, I plan on submitting a PR to the rustc dev guide in the near future documenting this and other recent changes to MIR. If there's any other places to update, do let me know r? `@nagisa`
2022-04-19compiletest: combine `--*-python` argsAlec Goncharow-16/+10
Since these arguments are now always the same, combine them into a singular `--python` argument.
2022-04-16Add support for MIR opt unit testsJakob Degen-1/+12
2022-04-11Auto merge of #94243 - compiler-errors:compiler-flags-typo, r=Mark-Simulacrumbors-0/+5
`s/compiler-flags/compile-flags` in compiletest Also make compiletest panic so this doesn't happen in the future! I literally always forget which it's called, so I wanted to make my life easier in the future. Also open to the possibility of parsing both.
2022-04-07Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrumbors-3/+1
Bump bootstrap compiler to 1.61.0 beta This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments. r? `@Mark-Simulacrum`
2022-04-05trivial cfg(bootstrap) changesPietro Albini-3/+1
2022-03-26Print the full relative path to failed testsJoshua Nelson-6/+4
Before: ``` failures: [ui] rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s ``` After: ``` failures: [ui] src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s ``` This allows copy pasting the path or using Ctrl+Click in IDEs to go directly to the file, instead of having to edit the filename first.
2022-03-18Re-enable parallel debuginfo testsTom Tromey-5/+0
Debuginfo tests are serialized due to some older version of LLDB. However, that comment was last touched in 2014, so presumably these older versions are long since obsolete. Partially fixes bug #72719.
2022-03-14debuginfo: Refactor debuginfo generation for types -- Address review comments.Michael Woerister-0/+2
2022-03-14debuginfo: Refactor debuginfo generation for types -- Run x.py fmtMichael Woerister-35/+7
2022-03-14compiletest: Don't update PDB files of test cases in-place.Michael Woerister-9/+48