diff options
| author | Pietro Albini <pietro.albini@ferrous-systems.com> | 2024-06-14 12:34:22 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2024-06-14 13:00:51 +0200 |
| commit | fcb6ff5171fd41c988a6c449f76ff34c2c2d5a43 (patch) | |
| tree | 00afc06634572cd4917427157a6b629150cf74b9 /src/bootstrap | |
| parent | d3f1618a73d3f14bfdd28d62c1d933755ccbad3e (diff) | |
| download | rust-fcb6ff5171fd41c988a6c449f76ff34c2c2d5a43.tar.gz rust-fcb6ff5171fd41c988a6c449f76ff34c2c2d5a43.zip | |
fix rust bootstrap tests requiring a downloaded stage0
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 36b44d0169c..6664c5b451c 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1189,7 +1189,19 @@ impl Config { pub fn parse(args: &[String]) -> Config { #[cfg(test)] fn get_toml(_: &Path) -> TomlConfig { - TomlConfig::default() + let mut default = TomlConfig::default(); + + // When configuring bootstrap for tests, make sure to set the rustc and Cargo to the + // same ones used to call the tests. If we don't do that, bootstrap will use its own + // detection logic to find a suitable rustc and Cargo, which doesn't work when the + // caller is specìfying a custom local rustc or Cargo in their config.toml. + default.build = Some(Build { + rustc: std::env::var_os("RUSTC").map(|v| v.into()), + cargo: std::env::var_os("CARGO").map(|v| v.into()), + ..Build::default() + }); + + default } #[cfg(not(test))] |
