Skip to content

Commit 8c5f490

Browse files
authored
Unrolled build for #146450
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`
2 parents 064cc81 + 472721b commit 8c5f490

File tree

1 file changed

+15
-1
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+15
-1
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,11 +2086,25 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?}
20862086
}
20872087

20882088
// Get paths from cmd args
2089-
let paths = match &builder.config.cmd {
2089+
let mut paths = match &builder.config.cmd {
20902090
Subcommand::Test { .. } => &builder.config.paths[..],
20912091
_ => &[],
20922092
};
20932093

2094+
// in rustdoc-js mode, allow filters to be rs files or js files.
2095+
// use a late-initialized Vec to avoid cloning for other modes.
2096+
let mut paths_v;
2097+
if mode == "rustdoc-js" {
2098+
paths_v = paths.to_vec();
2099+
for p in &mut paths_v {
2100+
if let Some(ext) = p.extension()
2101+
&& ext == "js"
2102+
{
2103+
p.set_extension("rs");
2104+
}
2105+
}
2106+
paths = &paths_v;
2107+
}
20942108
// Get test-args by striping suite path
20952109
let mut test_args: Vec<&str> = paths
20962110
.iter()

0 commit comments

Comments
 (0)