about summary refs log tree commit diff
path: root/src/bootstrap/test.rs
AgeCommit message (Collapse)AuthorLines
2022-07-07Rollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514Matthias Krüger-3/+3
replace process exit with more detailed exit in src/bootstrap/*.rs Fixes [#98830](https://github.com/rust-lang/rust/issues/98830) I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit. So, error code should panic in test code. ``` // lib.rs pub fn detail_exit(code: i32) -> ! { // Successful exit if code == 0 { std::process::exit(0); } if cfg!(test) { panic!("status code: {}", code); } else { std::panic::resume_unwind(Box::new(code)); } } ``` <details> <summary>% rg "exit\(" src/bootstrap/*.rs</summary> ``` builder.rs 351: crate::detail_exit(1); 1000: crate::detail_exit(1); 1429: crate::detail_exit(1); compile.rs 1331: crate::detail_exit(1); config.rs 818: crate::detail_exit(2); 1488: crate::detail_exit(1); flags.rs 263: crate::detail_exit(exit_code); 349: crate::detail_exit(exit_code); 381: crate::detail_exit(1); 602: crate::detail_exit(1); 616: crate::detail_exit(1); 807: crate::detail_exit(1); format.rs 35: crate::detail_exit(1); 117: crate::detail_exit(1); lib.rs 714: detail_exit(1); 1620: detail_exit(1); 1651:pub fn detail_exit(code: i32) -> ! { 1654: std::process::exit(0); sanity.rs 107: crate::detail_exit(1); setup.rs 97: crate::detail_exit(1); 290: crate::detail_exit(1); test.rs 676: crate::detail_exit(1); 1024: crate::detail_exit(1); 1254: crate::detail_exit(1); tool.rs 207: crate::detail_exit(1); toolstate.rs 96: crate::detail_exit(3); 111: crate::detail_exit(1); 182: crate::detail_exit(1); 228: crate::detail_exit(1); util.rs 339: crate::detail_exit(1); 378: crate::detail_exit(1); 468: crate::detail_exit(1); ``` </details>
2022-07-07squash the commitstoshiki goto-3/+3
implement detail_exit but I'm not sure it is right. not create new file and write detail exit in lib.rs replace std::process::exit to detail_exit that is not related to code runnning. remove pub
2022-07-05Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-SimulacrumGuillaume Gomez-16/+16
bootstrap: Allow building individual crates This aims to be as unintrusive as possible, but did still require adding a new `tail_args` field to all `Rustc` and `Std` steps. New library and compiler crates are added to the sysroot as they are built, since it's useful to have e.g. just alloc and not std. Fixes https://github.com/rust-lang/rust/issues/44293.
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-16/+16
- Add `Interned<Vec<String>>` and use it for tail args - Refactor `cache.rs` not to need a separate impl for each internable type
2022-07-02move optimize-tests flag handling from bootstrap to compiletestThe 8472-7/+1
2022-07-02Only obey optimize-tests flag on UI tests that are run-passThe 8472-1/+4
``` 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-06-18Pass all paths to `Step::run` at once when using `ShouldRun::krate`Joshua Nelson-13/+22
This was surprisingly complicated. The main changes are: 1. Invert the order of iteration in `StepDescription::run`. Previously, it did something like: ```python for path in paths: for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_path(path): step.run(builder, set) ``` That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run` (since `pathset_for_paths` only had one path available to it). Change it to instead look at the intersection of `paths` and `should_run.paths`: ```python for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_paths(paths): step.run(builder, set) ``` 2. Change `pathset_for_path` to take multiple pathsets. The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc. The changes here are similarly subtle, to use the intersection between the paths rather than all paths in `should_run.paths`. I added a test for the behavior to try and make it more clear. Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*). See the documentation added in the next commit for more detail. 3. Change `StepDescription::run` to explicitly handle 0 paths. Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths. Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`). 4. Change `RunDescription` to have a list of pathsets, rather than a single path. 5. Remove paths as they're matched This allows checking at the end that no invalid paths are left over. Note that if two steps matched the same path, this will no longer run both; but that's a bug anyway. 6. Handle suite paths separately from regular sets. Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful. The respective test Steps already handle this by introspecting the original paths. Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
2022-06-07Move beta rustfmt downloads to rustbuildJoshua Nelson-2/+2
2022-06-03Fully stabilize NLLJack Huey-6/+1
2022-05-30be less redundant redundantRalf Jung-4/+0
2022-05-30Let miri decide the flags to use for the test suiteOli Scherer-2/+0
2022-05-25Move download-rustc from bootstrap.py to rustbuildJoshua Nelson-2/+2
- Remove download-rustc handling from bootstrap.py - Allow a custom `pattern` in `builder.unpack()` - Only download rustc once another part of bootstrap depends on it. This is somewhat necessary since the download functions rely on having a full `Builder`, which isn't available until after config parsing finishes.
2022-05-08Auto merge of #96689 - gimbles:campfire, r=Mark-Simulacrumbors-0/+4
Move check-bootstrap from a makefile rule to test::Bootstrap Fixes #96688
2022-05-07Move check-bootstrap from a makefile rule to test::Bootstrapgimbles-0/+4
2022-05-05Don't constantly rebuild clippy on `x test src/tools/clippy`.Joshua Nelson-2/+0
This happened because the `SYSROOT` variable was set for `x test`, but not `x build`. Set it consistently for both to avoid unnecessary rebuilds.
2022-05-02Rollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-SimulacrumYuki Okushi-0/+11
Make it possible to write doctests for bootstrap This probably isn't super useful in practice, but it was easy to fix and avoids confusing errors about mismatched versions between beta and the default toolchain.
2022-04-27Make it possible to write doctests for bootstrapJoshua Nelson-0/+11
This probably isn't super useful in practice, but it was easy to fix and avoids confusing errors about mismatched versions between beta and the default toolchain.
2022-04-27Auto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrumbors-7/+4
Move `download-ci-llvm` out of bootstrap.py This is ready for review. It has been tested on Windows, Linux, and NixOS. The second commit ports the changes from https://github.com/rust-lang/rust/pull/95234 to Rust; I can remove it if desired. Helps with https://github.com/rust-lang/rust/issues/94829. As a follow-up, this makes it possible to avoid downloading llvm until it's needed for building `rustc_llvm`; it would be nice to do that, but it shouldn't go in the first draft. It might also be possible to avoid requiring python until tests run (currently there's a check in `sanity.rs`), but I haven't looked too much into that. `@rustbot` label +A-rustbuild
2022-04-24Use `build/tmp` instead of adding a dependency on `tempfile`.Joshua Nelson-7/+4
2022-04-19compiletest: combine `--*-python` argsAlec Goncharow-3/+1
Since these arguments are now always the same, combine them into a singular `--python` argument.
2022-04-18Auto merge of #95906 - jyn514:enforce-valid-paths, r=Mark-Simulacrumbors-1/+1
Require all paths passed to `ShouldRun::paths` to exist on disk This has two benefits: 1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components). 2. Bootstrap has better checks for internal consistency. This caught several issues: - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias. - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works. - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work. - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`. - `install` was still using `src/librustc` instead of `compiler/rustc`. - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like. Builds on https://github.com/rust-lang/rust/pull/95901 and should not be merged before.
2022-04-18Auto merge of #96000 - jyn514:faster-doctests, r=Mark-Simulacrumbors-2/+4
Make `x test --stage 2 compiler/rustc_XXX` faster to run Previously, bootstrap unconditionally rebuilt the stage 2 compiler, even if it had previously built stage 1. This changes it to reuse stage 1 if possible. In particular, it no longer runs the following step: ``` Building stage1 compiler artifacts (x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) -> x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu)) ```
2022-04-16Require all paths passed to `ShouldRun::paths` to exist on diskJoshua Nelson-1/+1
This has two benefits: 1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components). 2. Bootstrap has better checks for internal consistency. This caught several issues: - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias. - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works. - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work. - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`. - `install` was still using `src/librustc` instead of `compiler/rustc`. - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like.
2022-04-12Make `x test --stage 2 compiler/rustc_XXX` faster to runJoshua Nelson-2/+4
Previously, bootstrap unconditionally rebuilt the stage 2 compiler, even if it had previously built stage 1. This changes it to reuse stage 1 if possible.
2022-04-13Rollup merge of #95441 - AlecGoncharow:issue-95204-fix, r=Mark-SimulacrumDylan DPC-8/+1
Always use system `python3` on MacOS This PR includes 2 changes: 1. Always use the system Python found at `/usr/bin/python3` on MacOS 2. Removes the hard requirement on having `python` in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order: `python` -> `python3` -> `python2`. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist. Fixes #95204 r? ```@jyn514```
2022-04-10Auto merge of #95253 - jyn514:cargo-run, r=Mark-Simulacrumbors-4/+0
Make it possible to run `cargo test` for bootstrap Note that this only runs bootstrap's self-tests, not compiler or library tests. Helps with https://github.com/rust-lang/rust/issues/94829.
2022-04-10Auto merge of #95502 - jyn514:doc-rustc, r=Mark-Simulacrumbors-30/+6
Fix `x doc compiler/rustc` This also has a few cleanups to `doc.rs`. The last two commits I don't care about, but the first commit I'd like to keep - it will be very useful for https://github.com/rust-lang/rust/issues/44293. Fixes https://github.com/rust-lang/rust/issues/95447.
2022-04-09Make it possible to run `cargo test` for bootstrapJoshua Nelson-4/+0
Note that this only runs bootstrap's self-tests, not compiler or library tests.
2022-04-09Rollup merge of #95369 - jyn514:test-rustdoc, r=Mark-SimulacrumDylan DPC-6/+29
Fix `x test src/librustdoc` with `download-rustc` enabled The problem was two-fold: - Bootstrap was hard-coding that unit tests should always run with stage1, not stage2, and - It hard-coded the sysroot layout in stage1, which puts libLLVM.so in `lib/rustlib/` instead of just `lib/`. This also takes the liberty of fixing `test src/librustdoc --no-doc`, which has been broken since it was first added. It would be nice at some point to unify this logic with other tests; I opened a Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Inconsistency.20in.20.60x.20test.60 Fixes https://github.com/rust-lang/rust/issues/91071.
2022-03-30Simplify `make_run` for `test::Crate` by introducing `crate_paths` instead ↵Joshua Nelson-30/+6
of calculating them after the fact
2022-03-29Don't build the full compiler before running unit testsJoshua Nelson-1/+0
This has been present since `builder.ensure` was first added in https://github.com/rust-lang/rust/pull/43059. It's unclear to me why it was added then - I tested these changes locally with `x test compiler/rustc_data_structures --stage 0` and they worked fine. Fixes https://github.com/rust-lang/rust/issues/51748.
2022-03-29bootstrap: force system python3 on MacOSAlec Goncharow-8/+1
2022-03-27Fix `x test src/librustdoc --no-doc`Joshua Nelson-0/+9
Previously, it would erroneously try to run the doc-tests anyway and give an error: ``` Doc-tests rustdoc thread 'main' panicked at 'RUSTDOC_LIBDIR was not set', src/bootstrap/bin/rustdoc.rs:15:48 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: test failed, to rerun pass '--doc' ```
2022-03-27Fix `x test src/librustdoc` with download-rustc enabledJoshua Nelson-6/+20
The problem was two-fold: - Bootstrap was hard-coding that unit tests should always run with stage1, not stage2, and - It hard-coded the sysroot layout in stage1, which puts libLLVM.so in `lib/rustlib/` instead of just `lib/`.
2022-03-18Compare installed browser-ui-test version to the one used in CIGuillaume Gomez-17/+41
2022-03-07copy over `std::path::absolute` instead of adding `canonicalize` hacksJoshua Nelson-1/+1
this also fixes a bug where bootstrap would try to use the fake `rustc` binary built by bootstrap - cargo puts it in a different directory when using `cargo run` instead of x.py
2022-03-07fix weird bug when `out` would get overridden by unit testsJoshua Nelson-0/+2
2022-03-05Merge build_helper into utilbjorn3-5/+2
2022-03-05Remove build_helperbjorn3-2/+1
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-3/+12
First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables Note that this also necessitated an update to compiletest to treat CXXFLAGS separately from CFLAGS.
2022-01-21Override rustc version in ui and mir-opt tests to get stable hashesThe 8472-0/+3
Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles. Using `RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER` stabilizes hashes calcuated for the individual tests so no test-dependent normalization is needed. Hashes for the standard library still change so some normalizations are still needed.
2021-11-10Update more rustc/libtest things for wasm64Alex Crichton-1/+1
* Add wasm64 variants for inline assembly along the same lines as wasm32 * Update a few directives in libtest to check for `target_family` instead of `target_arch` * Update some rustc codegen and typechecks specialized for wasm32 to also work for wasm64.
2021-11-09Allow to run a specific rustdoc-js* testGuillaume Gomez-33/+20
2021-10-10Rollup merge of #89520 - GuillaumeGomez:cache-rustdoc-gui-test, ↵Matthias Krüger-1/+1
r=Mark-Simulacrum Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui This method has multiple advantages: * It'll completely remove the rustdoc-GUI test doc folder if rustdoc was updated * It'll rebuild GUI test crates only they have been updated All in all, it's quite convenient! (even more with https://github.com/rust-lang/rust/pull/88816) r? ```@Mark-Simulacrum```
2021-10-07Remove unused clippy bootstrap env varsCameron Steffen-8/+1
2021-10-04Don't rebuild GUI test crates every time you run test src/test/rustdoc-guiGuillaume Gomez-1/+1
2021-09-20Adjust to SourceType::InTree in several placesMark Rousskov-1/+1
These were left over in migrations to subtrees, which should generally be treated as-if it was local. Also fixes a warning caused by this change.
2021-09-13 * Enable generate-link-to-def feature on a rustdoc GUI testGuillaume Gomez-0/+5
* Add test for jump-to-def links background color
2021-08-16Take into account jobs number for rustdoc gui testsGuillaume Gomez-0/+2
2021-08-03Add x.py option to --force-rerun compiletest testsSmitty-0/+4