summary refs log tree commit diff
path: root/src/bootstrap/test.rs
AgeCommit message (Collapse)AuthorLines
2023-05-27Rollup merge of #111936 - ferrocene:pa-test-suite-metadata, r=jyn514Guillaume Gomez-0/+49
Include test suite metadata in the build metrics This PR enhances the build metadata to include structured information about the test suites being executed, allowing external tools consuming the metadata to understand what was being tested. The included metadata is: * Target triple * Host triple * Stage number * For compiletest tests: * Suite name * Mode * Comparing mode * For crate tests: * List of crate names This is implemented by replacing the `test` JSON node with a new `test_suite` node, which contains the metadata and the list of tests. This change also improves the handling of multiple test suites executed in the same step (for example in compiletest tests with a compare mode), as the multiple test suite executions will now be tracked in separate `test_suite` nodes. This included a breaking change in the build metrics metadata format. To better handle this, in the second commit this PR introduces the `metadata_version` top-level field. The old version is considered to be `0`, while the new one `1`. Bootstrap will also gracefully handle existing metadata of a different version. r? `@jyn514`
2023-05-27Auto merge of #111348 - ozkanonur:remove-hardcoded-rustdoc-flags, ↵bors-88/+28
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-26address review feedbackPietro Albini-2/+2
2023-05-25include test suite metadata in build metricsPietro Albini-0/+49
2023-05-20unset MIRI_BLESS for mir-opt-level 4 miri testsDrMeepster-0/+2
2023-05-20implement and use tools/rustdoc-gui-test in bootstrapozkanonur-88/+28
2023-05-14Auto merge of #111388 - clubby789:clap-complete, r=jyn514bors-1/+20
Generate shell completions for bootstrap with Clap Now that #110693 has been merged, we can look at generating shell completions for x.py with `clap_complete`. Leaving this as draft for now as I'm not sure of the best way to integration the completion generator. Additionally, the generated completions for zsh are completely broken (will need to be resolved upstream, it doesn't seem to handle subcommands + global arguments well). I don't have Fish installed and would be interested to know how well completions work there. Alternative to #107827
2023-05-12run miri tests with MIR opts in rustc CIRalf Jung-2/+19
2023-05-10Generate shell completions for bootstrap with Clapclubby789-1/+20
2023-05-07Auto merge of #110693 - clubby789:x-clap-take-2, r=Mark-Simulacrumbors-1/+1
Migrate bootstrap to Clap-based argument parsing Supercedes #108083 I chose to re-do the work rather than rebase the onto the large changes since the original PR. If it's preferred I can instead force-push the original PR to this version. cc `@jyn514` `@albertlarsan68`
2023-05-06Migrate bootstrap to Clap-based argumentsclubby789-1/+1
2023-05-04Use `free-args` consistently in bootstrapjyn-7/+6
Previously, this was only passed to miri and compiletest. Extended it to all other tests and binaries as well.
2023-05-04Rollup merge of #108865 - Zoxc:library-dummy-crate, r=jyn514Matthias Krüger-1/+1
Add a `sysroot` crate to represent the standard library crates This adds a dummy crate named `sysroot` to represent the standard library target instead of using the `test` crate. This allows the removal of `proc_macro` as a dependency of `test` allowing these 2 crates to build in parallel saving around 9 seconds locally.
2023-04-29Fix `x test --no-deps`jyn-18/+31
- Use `cargo metadata` to determine whether a crate has a library package or not - Collect metadata for all workspaces, not just the root workspace and cargo - Don't pass `--lib` for crates without a library - Use `run_cargo_test` for rust-installer - Don't build documentation in `lint-docs` if `--no-doc` is passed
2023-04-29Combine several `Step`s into a single step with multiple pathsjyn-110/+20
2023-04-29Convert the rest of the `test` Steps to run_cargo_testjyn-85/+79
2023-04-29switch Crate to run_cargo_testjyn-61/+43
2023-04-29[wip] separate out a test_crate_args fnjyn-16/+20
2023-04-29Remove unnecessary `test_kind` field and `TestKind` structjyn-65/+13
2023-04-25Add a `sysroot` crate to represent the standard library cratesJohn Kåre Alsaker-1/+1
2023-04-22Group entire build steps in the gha logsOli Scherer-24/+25
2023-04-18Auto merge of #110478 - jyn514:stage1-fulldeps, r=albertlarsan68bors-6/+19
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-6/+19
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-16Fix error due to renaming of ignore_gitErik Hofmayer-1/+1
2023-04-16Add needs-git-hash header to compiletestErik Hofmayer-0/+4
This header can be used for tests which check the output of `--version --verbose` commands.
2023-04-14Auto merge of #110324 - JohnTitor:rollup-jq31pd1, r=JohnTitorbors-0/+36
Rollup of 7 pull requests Successful merges: - #103682 (Stabilize rustdoc `--test-run-directory`) - #106249 (Create "suggested tests" tool in `rustbuild`) - #110047 (Add link to `collections` docs to `extend` trait) - #110269 (Add `tidy-alphabetical` to features in `core`) - #110292 (Add `tidy-alphabetical` to features in `alloc` & `std`) - #110305 (rustdoc-search: use ES6 `Map` and `Set` where they make sense) - #110315 (Add a stable MIR way to get the main function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-14Rollup merge of #106249 - Ezrashaw:suggest-test-tool, r=jyn514,albertlarsan68Yuki Okushi-0/+36
Create "suggested tests" tool in `rustbuild` Not the claimed person in #97339 but: I've done a very rough implementation of this feature in-tree. I'm very new to `rustc` development (outside of docs) so some help would be greatly appreciated. The UI of this new subcommand obviously will change and I need some mentoring with the `--run` flag. r? ```@jyn514```
2023-04-14Auto merge of #110177 - RalfJung:miri-tests, r=oli-obkbors-1/+4
fix running Miri tests This partially reverts https://github.com/rust-lang/rust/pull/108659 to fix https://github.com/rust-lang/rust/issues/110102: the Miri test runner does not support any flags, they are interpreted as filters instead which leads to no tests being run. I have not checked any of the other test runners for whether they are having any trouble with these flags. Cc `@pietroalbini` `@Mark-Simulacrum` `@jyn514`
2023-04-12Rollup merge of #110235 - GuillaumeGomez:fix-extend-css, r=notriddleMatthias Krüger-0/+2
Fix `--extend-css` option Fixes #110002. The file was generated in the wrong folder so I moved it into `static.files` as it made more sense to have there instead of changing the path in the templates. I also added a GUI test to ensure that this option won't break unexpectedly again.
2023-04-12Rollup merge of #110122 - jyn514:check-stage1-llvm, r=ozkanonurMatthias Krüger-1/+1
Fix x check --stage 1 when download-ci-llvm=false Bootstrap tries to avoid building LLVM unless it needs to; in particular we only build it for `x build`, not `x check`. Unfortunately, the check forgot about existence of stages - it would break if you used `x check --stage 1`: ``` = note: /usr/bin/ld: cannot find -lPolly: No such file or directory /usr/bin/ld: cannot find -lPollyISL: No such file or directory ``` Fix it to work for stage 1. I recommend reading this commit-by-commit; the first one makes a bunch of whitespace changes but otherwise doesn't change the logic.
2023-04-12Add/update tests for `--extend-css` optionGuillaume Gomez-0/+2
2023-04-11Rollup merge of #110018 - jfgoog:host-and-target-linker, r=wesleywiserMichael Goulet-1/+4
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-11fix running Miri testsRalf Jung-1/+4
2023-04-10Fix `x check --stage 1` when `download-ci-llvm=false`Joshua Nelson-1/+1
2023-04-09feat: implement basic suggest-tests toolEzra Shaw-0/+36
2023-04-07Auto merge of #109448 - ozkanonur:download-beta-compiler-toolchain, ↵bors-1/+1
r=Mark-Simulacrum Download beta compiler toolchain in bootstrap if it doesn't yet exist Blocker for #107812 and #99989 See: https://github.com/rust-lang/rust/pull/107812#discussion_r1143492202 r? `@jyn514`
2023-04-08download beta compiler toolchain in bootstrap if it doesn't yet existozkanonur-1/+1
This is needed for when the shell scripts bypass python altogether and run the downloaded bootstrap directly. Changes are mainly provided from @jyn514, I just fixed the review notes. Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-06Pass host linker to compiletest.James Farrell-1/+4
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-03fix remaining testsPietro Albini-1/+1
2023-03-24Rename 'src/bootstrap/native.rs' to llvm.rsRobin Hafid-7/+72
Renamed 'native.rs' to 'llvm.rs', also moved `TestHelpers` to `test.rs`.Replaced all the `native.rs` ocurrences at `src/bootstrap` files to `llvm.rs`
2023-03-21Auto merge of #108659 - ferrocene:pa-test-metrics, r=Mark-Simulacrumbors-27/+20
Include executed tests in the build metrics (and use a custom test display impl) The main goal of this PR is to include all tests executed in CI inside the build metrics JSON files. I need this for Ferrocene, and `@Mark-Simulacrum` expressed desire to have this as well to ensure all tests are executed at least once somewhere in CI. Unfortunately implementing this required rewriting inside of bootstrap all of the code to render the test output to console. libtest supports outputting JSON instead of raw text, which we can indeed use to populate the build metrics. Doing that suppresses the console output though, and compared to rustc and Cargo the console output is not included as a JSON field. Because of that, this PR had to reimplement both the "pretty" format (one test per line, with `rust.verbose-tests = true`), and the "terse" format (the wall of dots, with `rust.verbose-tests = false`). The current implementation should have the exact same output as libtest, except for the benchmark output. libtest's benchmark output is broken in the "terse" format, so since that's our default I slightly improved how it's rendered. Also, to bring parity with libtest I had to introduce support for coloring output from bootstrap, using the same dependencies `annotate-snippets` uses. It's now possible to use `builder.color_for_stdout(Color::Red, "text")` and `builder.color_for_stderr(Color::Green, "text")` across all of bootstrap, automatically respecting the `--color` flag and whether the stream is a terminal or not. I recommend reviewing the PR commit-by-commit. r? `@Mark-Simulacrum`
2023-03-18Let tidy use more threadsJoshua Nelson-1/+5
This has a significant speedup for me locally, from about 1.3 seconds to .9 seconds.
2023-03-07Add bootstrap support for rust-installerMark Rousskov-0/+55
2023-03-02do not use render_tests for clippyPietro Albini-1/+1
Behind the scenes Clippy uses compiletest-rs, which doesn't support the --json flag we added to Rust's compiletest.
2023-03-02switch all tests to use render_testsPietro Albini-23/+18
2023-03-02render compiletest output with render_testsPietro Albini-5/+3
2023-02-22Add no-fail-fast support to miri, rustfmt and clippy testsuitesJesus Checa Hidalgo-0/+12
This commit adds `--no-fail-fast` flag to each `cargo test` command in each tool Step trait implementation. Fixes #108261
2023-02-17Rollup merge of #107905 - clubby789:x-free-args, r=albertlarsan68Matthias Krüger-0/+1
Pass arguments to `x` subcommands with `--` Fixes #107375 Any arguments passed to `x` following `--` are removed and not parsed, instead passed down to subcommands (just the ones listed in the issue, not sure if more are needed). This does not remove the existing `--args` and `--test-args` behaviour, just extends it. It's also not documented in the help, not sure of the best way to format it. r? `@jyn514`
2023-02-11Rollup merge of #107657 - chenyukang:yukang/add-only-modified, r=albertlarsan68Matthias Krüger-0/+4
Add only modified subcommand for compiletest r? `@jyn514` From [discussion](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Add.20subcommand.20to.20retest.20all.20tests.20with.20different.20results)
2023-02-10Pass arguments to `x` subcommands with `--`clubby789-0/+1