about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2023-06-06Make TraitEngine::new use the right solver, add compare modeMichael Goulet-0/+4
2023-05-31Rollup merge of #111975 - jyn514:normalization, r=cjgillotMatthias Krüger-29/+18
Stop normalizing so many different prefixes Previously, we would normalize *all* of - the absolute path to the repository checkout - the /rustc/$sha for stage1 (if `remap-debuginfo` was enabled) - the /rustc/$sha for download-rustc - the sysroot for download-rustc Now, we consistently only normalize /rustc/FAKE_PREFIX. Not only is this much simpler, but it also avoids ongoing maintenance for download-rustc and makes it much less likely that tests break by accident. - Change `tests/ui/track-diagnostics/track6.rs` to use a relative path instead of an absolute one. I am not actually sure why `track_caller` works here, but it does seem to work :shrug: - Pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` to all suites, not just UI. In particular, mir-opt tests emit /rustc/ paths in their output. r? ```@cjgillot``` since you reviewed https://github.com/rust-lang/rust/pull/110699 - this is the test that it doesn't regress :)
2023-05-28Auto merge of #111813 - scottmcm:pretty-mir, r=cjgillotbors-1/+4
MIR: opt-in normalization of `BasicBlock` and `Local` numbering This doesn't matter at all for actual codegen, but after spending some time reading pre-codegen MIR, I was wishing I didn't have to jump around so much in reading post-inlining code. So this add two passes that are off by default for every mir level, but can be enabled (`-Zmir-enable-passes=+ReorderBasicBlocks,+ReorderLocals`) for humans.
2023-05-28Auto merge of #112000 - wesleywiser:safestack, r=Amanieubors-0/+9
Add support for LLVM SafeStack Adds support for LLVM [SafeStack] which provides backward edge control flow protection by separating the stack into two parts: data which is only accessed in provable safe ways is allocated on the normal stack (the "safe stack") and all other data is placed in a separate allocation (the "unsafe stack"). SafeStack support is enabled by passing `-Zsanitizer=safestack`. [SafeStack]: https://clang.llvm.org/docs/SafeStack.html cc `@rcvalle` #39699
2023-05-27Auto merge of #111348 - ozkanonur:remove-hardcoded-rustdoc-flags, ↵bors-1136/+1148
r=albertlarsan68,oli-obk new tool `rustdoc-gui-test` Implements new tool `rustdoc-gui-test` that allows using compiletest headers for `rustdoc-gui` tests.
2023-05-26Add SafeStack support to rustcWesley Wiser-0/+9
Adds support for LLVM [SafeStack] which provides backward edge control flow protection by separating the stack into two parts: data which is only accessed in provable safe ways is allocated on the normal stack (the "safe stack") and all other data is placed in a separate allocation (the "unsafe stack"). SafeStack support is enabled by passing `-Zsanitizer=safestack`. [SafeStack]: https://clang.llvm.org/docs/SafeStack.html
2023-05-26Stop normalizing so many different prefixesjyn-29/+18
Previously, we would normalize *all* of - the absolute path to the repository checkout - the /rustc/$sha for stage1 (if `remap-debuginfo` was enabled) - the /rustc/$sha for download-rustc - the sysroot for download-rustc Now, we consistently only normalize /rustc/FAKE_PREFIX. Not only is this much simpler, but it also avoids ongoing maintenance for download-rustc and makes it much less likely that tests break by accident. - Change `tests/ui/track-diagnostics/track6.rs` to use a relative path instead of an absolute one. I am not actually sure why `track_caller` works here, but it does seem to work :shrug: - Pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` to all suites, not just UI. In particular, mir-opt tests emit /rustc/ paths in their output.
2023-05-21Normalize block and local orders in mir-opt testsScott McMurray-1/+4
Since this only affects `PreCodegen MIR, and it would be nice for that to be resilient to permutations of things that don't affect the actual semantic behaviours.
2023-05-20derive `Default` trait for `compiletest::common::Config`ozkanonur-1/+7
2023-05-18Rollup merge of #111561 - dtolnay:compiletestdirexists, r=Mark-SimulacrumDylan DPC-1/+7
Include better context for "already exists" error in compiletest I encountered the following error from `x.py test tests/ui` today. ```console ---- [ui] tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs stdout ---- thread '[ui] tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 17, kind: AlreadyExists, message: "File exists" }', src/tools/compiletest/src/runtest.rs:134:43 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` I found it impossible to unblock myself without knowing which directory it was stuck on. Error message after this PR: ```console ---- [ui] tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs stdout ---- thread '[ui] tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs' panicked at 'called `Result::unwrap()` on an `Err` value: failed to create output base directory /git/rust/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/multiple-lifetimes Caused by: File exists (os error 17)', src/tools/compiletest/src/runtest.rs:139:10 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Now I was able to run `rm build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/multiple-lifetimes` and unblock myself. Seems to be related to #109509 moving *tests/ui/impl-trait/multiple-lifetimes.rs* to *tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs*.
2023-05-16add lib module to `src/tool/compiletest`ozkanonur-1135/+1141
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-16Auto merge of #111472 - djkoloski:compiletest_cfg_current_target, ↵bors-5/+84
r=compiler-errors Get current target config from` --print=cfg` Compiletest was switched to querying all targets using `--print=all-target-specs-json` and `--print=target-spec-json` in #108905. This unintentionally prevented codegen flags like `-Cpanic` from being reflected in the current target configuration. This change gets the current compiletest target config using `--print=cfg` like it was previously while still using the faster prints for getting information on all other targets. Fixes #110850. `@jyn514` might be interested in reviewing since they commented on the issue. cc `@tmandry` since this issue is affecting Fuchsia.
2023-05-14Include better context for "already exists" error in compiletestDavid Tolnay-1/+7
2023-05-11Get current target config from` --print=cfg`David Koloski-5/+84
Compiletest was switched to querying all targets using `--print=all-target-specs-json` and `--print=target-spec-json` in #108905. This unintentionally prevented codegen flags like `-Cpanic` from being reflected in the current target configuration. This change gets the current compiletest target config using `--print=cfg` like it was previously while still using the faster prints for getting information on all other targets. Fixes #110850.
2023-05-09bump windows crate 0.46 -> 0.48 in workspaceklensy-1/+1
2023-05-06Rollup merge of #111251 - mj10021:issue-109502-follow-up, r=oli-obkYuki Okushi-13/+21
Issue 109502 follow up, remove unnecessary Vec::new() from compile_test() As mentioned in comment on PR #110773 , adding a separate function to pass the test passes into the `dump-mir` is a bit nicer
2023-05-06Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiserYuki Okushi-5/+31
Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool This stabilizes the `raw-dylib` feature (#58713) for all architectures (i.e., `x86` as it is already stable for all other architectures). Changes: * Permit the use of the `raw-dylib` link kind for x86, the `link_ordinal` attribute and the `import_name_type` key for the `link` attribute. * Mark the `raw_dylib` feature as stable. * Stabilized the `-Zdlltool` argument as `-Cdlltool`. * Note the path to `dlltool` if invoking it failed (we don't need to do this if `dlltool` returns an error since it prints its path in the error message). * Adds tests for `-Cdlltool`. * Adds tests for being unable to find the dlltool executable, and dlltool failing. * Fixes a bug where we were checking the exit code of dlltool to see if it failed, but dlltool always returns 0 (indicating success), so instead we need to check if anything was written to `stderr`. NOTE: As previously noted (https://github.com/rust-lang/rust/pull/104218#issuecomment-1315895618) using dlltool within rustc is temporary, but this is not the first time that Rust has added a temporary tool use and argument: https://github.com/rust-lang/rust/pull/104218#issuecomment-1318720482 Big thanks to ``````@tbu-`````` for the first version of this PR (#104218)
2023-05-05add fn compile_test_with_passes()James Dietz-13/+21
2023-05-04add passes to miroptfiles struct and passed to -zdump-mir argsJames Dietz-21/+66
blessed new test
2023-05-02Rollup merge of #108161 - WaffleLapkin:const_param_ty, r=BoxyUwUDylan DPC-2/+5
Add `ConstParamTy` trait This is a bit sketch, but idk. r? `@BoxyUwU` Yet to be done: - [x] ~~Figure out if it's okay to implement `StructuralEq` for primitives / possibly remove their special casing~~ (it should be okay, but maybe not in this PR...) - [ ] Maybe refactor the code a little bit - [x] Use a macro to make impls a bit nicer Future work: - [ ] Actually™ use the trait when checking if a `const` generic type is allowed - [ ] _Really_ refactor the surrounding code - [ ] Refactor `marker.rs` into multiple modules for each "theme" of markers
2023-04-29Rollup merge of #110644 - pietroalbini:pa-json-formatting-tests, ↵Matthias Krüger-5/+37
r=Mark-Simulacrum Update tests for libtest `--format json` This PR makes the test work on beta and stable, and adds a test ensuring the option is not available on beta and stable. Backported these commits from https://github.com/rust-lang/rust/pull/110414.
2023-04-28handle cfg(bootstrap)Pietro Albini-37/+5
2023-04-27Rollup merge of #110853 - tamird:compiletest-bpflinker-support, r=wesleywiserMatthias Krüger-0/+8
compiletest: add bpf-linker assembly support
2023-04-27Fix compile test so it normalizes (un)expected error messagesMaybe Waffle-2/+5
2023-04-26compiletest: add bpf-linker assembly supportTamir Duberstein-0/+8
2023-04-26compiletest: emit assembly-output header in errorTamir Duberstein-1/+1
2023-04-21add support for `// unset-exec-env` in compiletestPietro Albini-4/+32
2023-04-21treat the dev channel as nightly in compiletestPietro Albini-1/+5
2023-04-20Auto merge of #110444 - ferrocene:comptest-lines, r=Mark-Simulacrumbors-8/+68
Add compare-output-lines-by-subset flag to compiletest For [ferrocene](github.com/ferrocene/) we have some compiletests that check the output of the cli arguments to the compiler, including printing things like the target list (`--print target-list`). Unfortunately those tend to change quite often so when we sync we end up with some outputs we have to re-bless constantly, even though the exact output doesn't really matter. We added a new compiletest flag to aid writing these kinds of tests: `compare-output-lines-by-subset`. It checks whether the lines of the expected output are a subset (or equal) to the lines of the actual output. If the expected output is empty it will fail unless the actual output is also empty. We opened this PR hoping the flag might be helpful for other tests in the future (especially if CLI-related tests are added in the future in the rust-lang/rust repo itself).
2023-04-20Add compare-output-lines-by-subset flag to compiletestLukas Wirth-8/+68
2023-04-20Allow overwriting the sysroot compile flag in compile testsLukas Wirth-2/+5
2023-04-18Stablize raw-dylib, link_ordinal and -CdlltoolDaniel Paoliello-5/+31
2023-04-18Auto merge of #110478 - jyn514:stage1-fulldeps, r=albertlarsan68bors-1/+6
Support `x test --stage 1 ui-fulldeps` `@Nilstrieb` had an excellent idea the other day: the same way that rustdoc is able to load `rustc_driver` from the sysroot, ui-fulldeps tests should also be able to load it from the sysroot. That allows us to run fulldeps tests with stage1, without having to fully rebuild the compiler twice. It does unfortunately have the downside that we're building the tests with the *bootstrap* compiler, not the in-tree sources, but since most of the fulldeps tests are for the *API* of the compiler, that seems ok. I think it's possible to extend this to `run-make-fulldeps`, but I've run out of energy for tonight. - Move `plugin` tests into a subdirectory. Plugins are loaded at runtime with `dlopen` and so require the ABI of the running compile to match the ABI of the compiler linked with `rustc_driver`. As a result they can't be supported in stage 1 and have to use `// ignore-stage1`. - Remove `ignore-stage1` from most non-plugin tests - Ignore diagnostic tests in stage 1. Even though this requires a stage 2 build to load rustc_driver, it's primarily testing the error message that the *running* compiler emits when the diagnostic struct is malformed. - Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That allows running `hash-stable-is-unstable` in stage1, since it now suggests adding `rustc_private` to enable loading the crates. - Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests that act as custom drivers to load it at runtime. - Pass `--sysroot stage0-sysroot` in compiletest so that we use the correct version of std. - Move a few lint tests from ui-fulldeps to ui These had an `aux-build:lint-group-plugin-test.rs` that they never actually loaded with `feature(plugin)` nor tested. I removed the unused aux-build and they pass fine with stage 1. Fixes https://github.com/rust-lang/rust/issues/75905.
2023-04-17Support `x test --stage 1 ui-fulldeps`jyn-1/+6
Nils had an excellent idea the other day: the same way that rustdoc is able to load `rustc_driver` from the sysroot, ui-fulldeps tests should also be able to load it from the sysroot. That allows us to run fulldeps tests with stage1, without having to fully rebuild the compiler twice. It does unfortunately have the downside that we're running the tests on the *bootstrap* compiler, not the in-tree sources, but since most of the fulldeps tests are for the *API* of the compiler, that seems ok. I think it's possible to extend this to `run-make-fulldeps`, but I've run out of energy for tonight. - Move `plugin` tests into a subdirectory. Plugins are loaded at runtime with `dlopen` and so require the ABI of the running compile to match the ABI of the compiler linked with `rustc_driver`. As a result they can't be supported in stage 1 and have to use `// ignore-stage1`. - Remove `ignore-stage1` from most non-plugin tests - Ignore diagnostic tests in stage 1. Even though this requires a stage 2 build to load rustc_driver, it's primarily testing the error message that the *running* compiler emits when the diagnostic struct is malformed. - Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That allows running `hash-stable-is-unstable` in stage1, since it now suggests adding `rustc_private` to enable loading the crates. - Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests that act as custom drivers to load it at runtime. - Pass `--sysroot stage0-sysroot` in compiletest so that we use the correct version of std.
2023-04-16Add needs-git-hash header to compiletestErik Hofmayer-0/+20
This header can be used for tests which check the output of `--version --verbose` commands.
2023-04-15Auto merge of #110319 - ferrocene:pa-more-ignore-reasons, r=ehussbors-187/+458
[compiletest] Add more test ignore reasons, `needs-` validation, and improved error messages This PR makes more improvements to the way compiletest ignoring headers are handled, following up on #108905: * Human-readable ignore reasons have been added for the remaining ignore causes (`needs-*` directives, `*llvm*` directives, and debugger version directives). All ignored tests should now have a human-readable reason. * The code handling `needs-*` directives has been refactored, and now invalid `needs-*` directive emit errors like `ignore-*` and `only-*`. * All errors are now displayed at startup (with line numbers) rather than just the first error of the first file. This PR is best reviewed commit-by-commit. r? `@ehuss`
2023-04-14mark needs-llvm-components as being handled elsewherePietro Albini-0/+5
2023-04-14use a shared headers cachePietro Albini-9/+28
2023-04-14add line numbers to error messagesPietro Albini-6/+8
2023-04-14show all invalid directives errors rather than just the first onePietro Albini-5/+36
2023-04-14refactor ignore- and only- to use decisionsPietro Albini-53/+50
2023-04-14rename rust-lldb to needs-rust-lldb for consistencyPietro Albini-9/+6
2023-04-14refactor needs, validate them, and add ignore reasonsPietro Albini-104/+250
2023-04-14add pretty ignore reasons for llvm, cdb, gdb and lldbPietro Albini-33/+107
2023-04-11Rollup merge of #110018 - jfgoog:host-and-target-linker, r=wesleywiserMichael Goulet-7/+16
Pass host linker to compiletest. Tests marked `// force-host` were using the default linker, even if a custom linker was configured in config.toml. This change adds a new flag, --host-linker, to compiletest, and renames --linker to --target-linker.
2023-04-10Rollup merge of #110115 - jyn514:remap-path-prefix-ci, r=compiler-errorsDylan DPC-2/+7
compiletest: Use remap-path-prefix only in CI This makes jump-to-definition work in most IDEs, as well as being easier to understand for contributors. Fixes https://github.com/rust-lang/rust/issues/109725. cc `@TimNN`
2023-04-09Rollup merge of #110114 - jyn514:wasm-errors, r=compiler-errorsMatthias Krüger-2/+2
compiletest: Give a better error message if `node` isn't installed
2023-04-09Auto merge of #109751 - bzEq:aix-gmake, r=Mark-Simulacrumbors-0/+1
AIX uses gmake for GNU style Makefile AIX's `make` is SystemV style, should use `gmake` for GNU style Makefile.
2023-04-09compiletest: Use remap-path-prefix only in CIJoshua Nelson-2/+7
This makes jump-to-definition work in most IDEs, as well as being easier to understand for contributors.
2023-04-09compiletest: Give a better error message if `node` isn't installedJoshua Nelson-2/+2