about summary refs log tree commit diff
path: root/src/bootstrap/builder/tests.rs
AgeCommit message (Collapse)AuthorLines
2023-10-17improve bootstrap tests structureonur-ozkan-701/+0
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-06remove the use of `fn update_submodule` on rust-analyzeronur-ozkan-1/+0
We don't need to run `fn update_submodule` on rust-analyzer as it's no longer a submodule. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-09-08Fix Issue 112009LuuuX-2/+2
modify fuction clond() -> cloned() optimize the code Handle the problem that the pathset is empty and modify the judgment of the builder::tests::test_exclude_kind Delete unnecessary judegment conditions skip test for library/std duo to OOM in benches as library/alloc Add FIXME for WASM32
2023-08-10Auto merge of #112482 - tgross35:ci-non-rust-linters, r=pietroalbinibors-0/+2
Add support for tidy linting via external tools for non-rust files This change adds the flag `--check-extras` to `tidy`. It accepts a comma separated list of any of the options: * py (test everything applicable for python files) * py:lint (lint python files using `ruff`) * py:fmt (check formatting for python files using `black`) * shell or shell:lint (lint shell files using `shellcheck`) Specific files to check can also be specified via positional args. Examples: * `./x test tidy --check-extras=shell,py` * `./x test tidy --check-extras=py:fmt -- src/bootstrap/bootstrap.py` * `./x test tidy --check-extras=shell -- src/ci/*.sh` * Python formatting can be applied with bless: `./x test tidy --ckeck-extras=py:fmt --bless` `ruff` and `black` need to be installed via pip; this tool manages these within a virtual environment at `build/venv`. `shellcheck` needs to be installed on the system already. --- This PR doesn't fix any of the errors that show up (I will likely go through those at some point) and it doesn't enforce anything new in CI. Relevant zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Other.20linters.20in.20CI
2023-08-06fix(bootstrap): rename exclude flag to skip 🐛Meysam Azad-2/+2
2023-08-02Add support for tidy linting via external tools for non-rust filesTrevor Gross-0/+2
This change adds the flag `--check-extras` to `tidy`. It accepts a comma separated list of any of the options: - py (test everything applicable for python files) - py:lint (lint python files using `ruff`) - py:fmt (check formatting for python files using `black`) - shell or shell:lint (lint shell files using `shellcheck`) Specific files to check can also be specified via positional args. Examples: - `./x test tidy --check-extras=shell,py` - `./x test tidy --check-extras=py:fmt -- src/bootstrap/bootstrap.py` - `./x test tidy --check-extras=shell -- src/ci/*.sh` - Python formatting can be applied with bless: `./x test tidy --ckeck-extras=py:fmt --bless` `ruff` and `black` need to be installed via pip; this tool manages these within a virtual environment at `build/venv`. `shellcheck` needs to be installed on the system already.
2023-07-14bootstrap: update defaults for `compiler` and `library` aliasesLukas Markeffsky-2/+6
2023-06-04cleanup now that Kind is no longer used for excludesjyn-22/+15
2023-05-29Switch doc::{Std, Rustc} to `crate_or_deps`jyn-0/+14
Previously they were using `all_krates` and various hacks to determine which crates to document. Switch them to `crate_or_deps` so `ShouldRun` tells them which crate to document instead of having to guess. This also makes a few other refactors: - Remove the now unused `all_krates`; new code should only use `crate_or_deps`. - Add tests for documenting Std - Remove the unnecessary `run_cargo_rustdoc_for` closure so that we only run cargo once - Give a more helpful error message when documenting a no_std target - Use `builder.msg` in the Steps instead of `builder.info`
2023-05-20bootstrap: add test cases for beta revision extractionliushuyu-0/+16
2023-05-06Migrate bootstrap to Clap-based argumentsclubby789-8/+11
2023-04-29Remove unnecessary `test_kind` field and `TestKind` structjyn-1/+0
2023-02-10add only modified for compiletestyukang-0/+2
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-2/+2
2022-09-17Add a new component, `rust-json-docs`, to distribute the JSON-formatted ↵Luca Palmieri-2/+2
documentation for std crates in nightly toolchains. We also add a new flag to `x doc`, `--json`, to render the JSON-formatted version alongside the HTML-formatted one.
2022-07-31Move `x test --skip` to be part of `--exclude`Joshua Nelson-2/+0
`--skip` is inconsistent with the rest of the interface and redundant with `--exclude`. Fix --exclude to work properly for files and directories rather than having a separate flag. If someone needs to use --skip for something other than compiletest, they can use `--test-args --skip` instead.
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-62/+63
- Add `Interned<Vec<String>>` and use it for tail args - Refactor `cache.rs` not to need a separate impl for each internable type
2022-06-18Add tests for fixed bugsJoshua Nelson-4/+36
2022-06-18Pass all paths to `Step::run` at once when using `ShouldRun::krate`Joshua Nelson-1/+8
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-05-13Auto merge of #96493 - chbaker0:issue-96342-fix, r=Mark-Simulacrumbors-0/+2
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-10Fix running bootstrap tests on a fresh cloneJoshua Nelson-0/+12
In #96303, I changed the tests not to manage submodules, with the main goal of avoiding a clone for llvm-project. Unfortunately, there are some tests which depend on submodules - I didn't notice locally because they were already checked out for me, and CI doesn't use submodule handling at all. Fresh clones, however, were impacted: ``` failures: ---- builder::tests::defaults::doc_default stdout ---- thread 'main' panicked at 'fs::read_dir(builder.src.join(&relative_path).join("redirects")) failed with No such file or directory (os error 2)', src/bootstrap/doc.rs:232:21 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ---- builder::tests::dist::dist_only_cross_host stdout ---- thread 'main' panicked at 'fs::read_to_string(&toml_file_name) failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1314:20 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Try and get the best of both worlds by only checking out the submodules actually used in tests.
2022-05-10Add test skip supportCollin Baker-0/+2
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-04-21Use `run_build` helper consistently across most bootstrap testsJoshua Nelson-96/+69
This is not super important to do, but the consistency is nice. I didn't change any tests that call `configure("dist")` and then override the subcommand - doing that at all is pretty sketchy, but I don't want to mess with it while already doing a refactor.
2022-04-21Add a test for `--exclude test::XXX`Joshua Nelson-29/+43
I didn't know that the `test::` syntax was valid before, and it doesn't seem to be documented anywhere. Add a test so it doesn't regress accidentally, and as executable documentation.
2022-04-21Don't checkout submodules in bootstrap testsJoshua Nelson-0/+1
This doesn't cause any tests to fail, and can greatly speed them up.
2022-04-09Make it possible to run `cargo test` for bootstrapJoshua Nelson-5/+2
Note that this only runs bootstrap's self-tests, not compiler or library tests.
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-2/+2
2022-01-21allow excluding paths only from a single modulePietro Albini-2/+2
x.py has support for excluding some steps from the invocation, but unfortunately that's not granular enough: some steps have the same name in different modules, and that prevents excluding only *some* of them. As a practical example, let's say you need to run everything in `./x.py test` except for the standard library tests, as those tests require IPv6 and need to be executed on a separate machine. Before this commit, if you were to just run this: ./x.py test --exclude library/std ...the execution would fail, as that would not only exclude running the tests for the standard library, it would also exclude generating its documentation (breaking linkchecker). This commit adds support for an optional module annotation in --exclude paths, allowing the user to choose which module to exclude from: ./x.py test --exclude test::library/std This maintains backward compatibility, but also allows for more ganular exclusion. More examples on how this works: | `--exclude` | Docs | Tests | | ------------------- | ------- | ------- | | `library/std` | Skipped | Skipped | | `doc::library/std` | Skipped | Run | | `test::library/std` | Run | Skipped | Note that the new behavior only works in the `--exclude` flag, and not in other x.py arguments or flags yet.
2021-08-03Add x.py option to --force-rerun compiletest testsSmitty-0/+3
2021-06-09Test the linkchecker itself.Eric Huss-0/+5
2021-04-30Add run flag to bootstrap testTyler Mandry-0/+3
2021-03-24Fix bootstrap tests on betaMark Rousskov-0/+3
2021-01-31rustbuild: Don't build compiler twice for error-index-generator.Eric Huss-3/+3
2020-09-28Remove skip_only_host_stepsTyler Mandry-45/+22
And make tests explicitly list their hosts and targets.
2020-09-28bootstrap: Always build for host, even when target is givenTyler Mandry-12/+7
This changes the behavior from *not* building for host whenever an explicit target is specified. I find this much less confusing. You can still disable host steps by passing an explicit empty list for host. Fixes #76990.
2020-09-22Auto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichtonbors-0/+48
Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve #76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in #76549.
2020-09-20Specify output directory for bootstrap testsMark Rousskov-0/+3
2020-09-17Add test for x.py build cross-compilationMark Rousskov-0/+48
2020-09-15Make the default stage for x.py configurableJoshua Nelson-7/+7
This allows configuring the default stage for each sub-command individually. - Normalize the stage as early as possible, so there's no confusion about which to use. - Don't add an explicit `stage` option in config.toml This offers no more flexibility than `*_stage` and makes it confusing which takes precedence. - Always give `--stage N` precedence over config.toml - Fix bootstrap tests This changes the tests to go through `Config::parse` so that they test the actual defaults, not the dummy ones provided by `default_opts`. To make this workable (and independent of the environment), it does not read `config.toml` for tests.
2020-09-11Verify we compile std without involving a b host compilerMark Rousskov-0/+10
2020-09-11Remove host parameter from step configurationsMark Rousskov-10/+0
rustc is a natively cross-compiling compiler, and generally none of our steps should care whether they are using a compiler built of triple A or B, just the --target directive being passed to the running compiler. e.g., when building for some target C, you don't generally want to build two stds: one with a host A compiler and the other with a host B compiler. Just one std is sufficient.
2020-09-01Move ninja requirements to a dynamic check, when actually buildingMark Rousskov-1/+1
It isn't practical to determine whether we'll build LLVM very early in the pipeline, so move the ninja checking to a dynamic check.
2020-08-30mv compiler to compiler/mark-1/+1
2020-08-28Disable ninja on the dry-run builderJosh Triplett-0/+1
2020-07-28reenable tests after moving stdmark-3/+1
2020-07-28Fix bad rebaseJoshua Nelson-1/+1
2020-07-27Add tests for the new behaviorJoshua Nelson-3/+92
- Only set stage 2 in dist tests - Add test for `x.py doc` without args - Add test for `x.py build` without args - Add test for `x.py build --stage 0`
2020-07-27Move tests into a submoduleJoshua Nelson-461/+470