diff options
| author | bors <bors@rust-lang.org> | 2024-02-22 14:39:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-22 14:39:16 +0000 |
| commit | 933a05bd0ba91caf219222e5f61d1c92d141ff61 (patch) | |
| tree | 57ea6c8a8cf9c9a872eaac1324d9804e733b0621 | |
| parent | 1bb3a9f67a2ff6bd49c513ca1b8954237298c4b3 (diff) | |
| parent | eee56725f0020555d761e3fbd539108c44a3f041 (diff) | |
| download | rust-933a05bd0ba91caf219222e5f61d1c92d141ff61.tar.gz rust-933a05bd0ba91caf219222e5f61d1c92d141ff61.zip | |
Auto merge of #121372 - clubby789:test-all-tests, r=onur-ozkan
Make `x test tests` work Fixes #97314 This makes `x test tests` work, and be roughly equivalent to `x test tests/*`. The `--dry-run` output is identical, except for errors on the non-test items in `tests` and a couple of things being in a different order (where path != struct name). This probably needs a test, but I'm not sure of the best way to do it.
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 97819403ab7..0ec5e16de1d 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -288,16 +288,61 @@ impl PathSet { } } -const PATH_REMAP: &[(&str, &str)] = &[("rust-analyzer-proc-macro-srv", "proc-macro-srv-cli")]; - -fn remap_paths(paths: &mut [&Path]) { - for path in paths.iter_mut() { +const PATH_REMAP: &[(&str, &[&str])] = &[ + // config.toml uses `rust-analyzer-proc-macro-srv`, but the + // actual path is `proc-macro-srv-cli` + ("rust-analyzer-proc-macro-srv", &["proc-macro-srv-cli"]), + // Make `x test tests` function the same as `x t tests/*` + ( + "tests", + &[ + "tests/assembly", + "tests/codegen", + "tests/codegen-units", + "tests/coverage", + "tests/coverage-run-rustdoc", + "tests/debuginfo", + "tests/incremental", + "tests/mir-opt", + "tests/pretty", + "tests/run-make", + "tests/run-make-fulldeps", + "tests/run-pass-valgrind", + "tests/rustdoc", + "tests/rustdoc-gui", + "tests/rustdoc-js", + "tests/rustdoc-js-std", + "tests/rustdoc-json", + "tests/rustdoc-ui", + "tests/ui", + "tests/ui-fulldeps", + ], + ), +]; + +fn remap_paths(paths: &mut Vec<&Path>) { + let mut remove = vec![]; + let mut add = vec![]; + for (i, path) in paths + .iter() + .enumerate() + .filter_map(|(i, path)| if let Some(s) = path.to_str() { Some((i, s)) } else { None }) + { for &(search, replace) in PATH_REMAP { - if path.to_str() == Some(search) { - *path = Path::new(replace) + // Remove leading and trailing slashes so `tests/` and `tests` are equivalent + if path.trim_matches(std::path::is_separator) == search { + remove.push(i); + add.extend(replace.into_iter().map(Path::new)); + break; } } } + remove.sort(); + remove.dedup(); + for idx in remove.into_iter().rev() { + paths.remove(idx); + } + paths.append(&mut add); } impl StepDescription { |
