Skip to content

Commit 103b2cc

Browse files
Rollup merge of rust-lang#96375 - jyn514:bootstrap-submodules, r=Mark-Simulacrum
Fix running bootstrap tests on a fresh clone In rust-lang#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.
2 parents b4d6465 + 0079aad commit 103b2cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bootstrap/builder/tests.rs

+9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
77
// don't save toolstates
88
config.save_toolstates = None;
99
config.dry_run = true;
10+
11+
// Ignore most submodules, since we don't need them for a dry run.
12+
// But make sure to check out the `doc` and `rust-analyzer` submodules, since some steps need them
13+
// just to know which commands to run.
14+
let submodule_build = Build::new(Config::parse(&["check".to_owned()]));
15+
let submodule_builder = Builder::new(&submodule_build);
16+
submodule_builder.update_submodule(Path::new("src/doc/book"));
17+
submodule_builder.update_submodule(Path::new("src/tools/rust-analyzer"));
1018
config.submodules = Some(false);
19+
1120
config.ninja_in_file = false;
1221
// try to avoid spurious failures in dist where we create/delete each others file
1322
// HACK: rather than pull in `tempdir`, use the one that cargo has conveniently created for us

0 commit comments

Comments
 (0)