Skip to content

Commit

Permalink
fix cargo path logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 1, 2024
1 parent c4cab8a commit dd2ac08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,10 @@ impl Step for Cargo {
// those features won't be able to land.
cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
cargo.env("PATH", path_for_cargo(builder, compiler));
// Cargo's test suite requires configurations from its own `.cargo/config.toml`.
// Change to the directory so Cargo can read from it.
cargo.current_dir(builder.src.join(Self::CRATE_PATH));
// Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is
// relative to. Cargo no longer sets this env var, so we have to do that. This has to be the
// same value as `-Zroot-dir`.
cargo.env("CARGO_RUSTC_CURRENT_DIR", builder.src.display().to_string());

#[cfg(feature = "build-metrics")]
builder.metrics.begin_test_suite(
Expand Down

0 comments on commit dd2ac08

Please sign in to comment.