diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-09-13 03:26:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-13 03:26:03 -0400 |
| commit | 7be418947e858d0b6f52d453ef377cd77de9aeaf (patch) | |
| tree | 9a7ae0e93d68b15824f6d775056ed4452defc537 | |
| parent | 82bb6d523bf3b1e6cd8d160565ab18d01640a4dd (diff) | |
| parent | 472721b34f73e7a5e6870c9443c35e3ab29958d9 (diff) | |
| download | rust-7be418947e858d0b6f52d453ef377cd77de9aeaf.tar.gz rust-7be418947e858d0b6f52d453ef377cd77de9aeaf.zip | |
Rollup merge of #146450 - lolbinarycat:bootstrap-test-js, r=jieyouxu
bootstrap: rustdoc-js tests can now be filtered by js files Before, a command like `./x test tests/rustdoc-js/path-ordering.js` would succeed, but run no tests, since the names of the tests are based on the `.rs` file. This is a bit confusing, as the `rustdoc-js-std` test suite only has `.js` files, and thus those are the files you filter on. Now, `./x test tests/rustdoc-js/path-ordering.js` will be treated as an alias for `./x test tests/rustdoc-js/path-ordering.rs`. This is fairly simple as each `rustdoc-js` test has 2 files, 1 js file and one rust file, each with an identical base filename, so all we need to do is swap the extension. r? `@Kobzol`
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 4f839bdf7b8..723ba80eaf8 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2086,11 +2086,25 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?} } // Get paths from cmd args - let paths = match &builder.config.cmd { + let mut paths = match &builder.config.cmd { Subcommand::Test { .. } => &builder.config.paths[..], _ => &[], }; + // in rustdoc-js mode, allow filters to be rs files or js files. + // use a late-initialized Vec to avoid cloning for other modes. + let mut paths_v; + if mode == "rustdoc-js" { + paths_v = paths.to_vec(); + for p in &mut paths_v { + if let Some(ext) = p.extension() + && ext == "js" + { + p.set_extension("rs"); + } + } + paths = &paths_v; + } // Get test-args by striping suite path let mut test_args: Vec<&str> = paths .iter() |
