Skip to content

Commit

Permalink
fix rust bootstrap tests requiring a downloaded stage0
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Jun 14, 2024
1 parent d3f1618 commit fcb6ff5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down

0 comments on commit fcb6ff5

Please sign in to comment.