Repository navigation
Description
Currently in config parser flow there are multiple other tasks involved such as validating stage 0 binaries and LLVM tools and downloading the beta toolchain. These logics are currently coupled in a single function as can be seen here:
rust/src/bootstrap/src/core/config/config.rs
Lines 1429 to 1447 in 3314d5c
| config.initial_rustc = if let Some(rustc) = rustc { | |
| if !flags.skip_stage0_validation { | |
| config.check_stage0_version(&rustc, "rustc"); | |
| } | |
| PathBuf::from(rustc) | |
| } else { | |
| config.download_beta_toolchain(); | |
| config.out.join(config.build.triple).join("stage0/bin/rustc") | |
| }; | |
| config.initial_cargo = if let Some(cargo) = cargo { | |
| if !flags.skip_stage0_validation { | |
| config.check_stage0_version(&cargo, "cargo"); | |
| } | |
| PathBuf::from(cargo) | |
| } else { | |
| config.download_beta_toolchain(); | |
| config.out.join(config.build.triple).join("stage0/bin/cargo") | |
| }; |
Doing this results in performing downloads, expecting valid stage 0 binaries and LLVM tools even in unit tests of bootstrap itself.
To avoid this issue, we pass some configurations from the test functions like this:
rust/src/bootstrap/src/core/config/tests.rs
Lines 18 to 19 in 3314d5c
| "--config=/does/not/exist".to_owned(), | |
| "--skip-stage0-validation".to_owned(), |
However, this approach is not sustainable as it could be easily missed when adding new tests. If we simplify parser functions to only parse values and perform validations and downloads immediately after the configuration parsing, this could resolve all the issues and make this process much simpler.
Activity
onur-ozkan commentedon Mar 6, 2024
This should be the right place:
rust/src/bootstrap/src/bin/main.rs
Lines 20 to 23 in 3314d5c
Rollup merge of rust-lang#125273 - onur-ozkan:bootstrap-self-test, r=…
Rollup merge of rust-lang#125273 - onur-ozkan:bootstrap-self-test, r=…
Rollup merge of rust-lang#125273 - onur-ozkan:bootstrap-self-test, r=…
Rollup merge of rust-lang#125273 - onur-ozkan:bootstrap-self-test, r=…
Unrolled build for rust-lang#125273
Rollup merge of #125273 - onur-ozkan:bootstrap-self-test, r=albertlar…
Rollup merge of #125273 - onur-ozkan:bootstrap-self-test, r=albertlar…