Repository navigation
tests: stop relying on Cargo's target layout to find binaries - #3076
Merged
sylvestre merged 2 commits intoNov 29, 2026
Merged
Conversation
Command::cargo_bin falls back to walking up from current_exe(), which breaks when build-dir is moved out of target/. Use cargo_bin_cmd!, which reads the compile-time CARGO_BIN_EXE_sccache, and require assert_cmd 2.1. The nested cargo builds in sccache_cargo and cache_hit_rate also inherited the outer build-dir, so their intermediates landed in one shared directory outside each test's tempdir. Pin build-dir to each test's target dir. Fixes mozilla#2520 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3076 +/- ##
=======================================
Coverage 80.68% 80.69%
=======================================
Files 78 78
Lines 48610 48609 -1
=======================================
+ Hits 39223 39225 +2
+ Misses 9387 9384 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sylvestre
reviewed
Nov 28, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Collaborator
|
Thanks for your PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2520.
sccache_rustc used
Command::cargo_bin, which can fall back to guessing where the binary is from the test executable's path. That guess breaks once Cargo's build-dir is moved out of target/. It now usescargo_bin_cmd!, which readsCARGO_BIN_EXE_sccacheat compile time, so assert_cmd needs to be at least 2.1.Running the whole suite with build-dir set turned up a second problem. Tests that run a nested
cargo buildinherited the outer build-dir, so their intermediates landed in one shared directory outside each test's tempdir, and cache_hit_rate and sccache_cargo failed. The test helpers now pin build-dir to each test's own target dir. sccache doesn't hashCARGO_BUILD_*directly, so these tests' cache keys don't change.To keep this from regressing, the 1.91 Linux job (ubuntu-24.04 cuda12.8) gets one extra step that runs sccache_rustc, sccache_cargo and cache_hit_rate with
CARGO_BUILD_BUILD_DIR="{cargo-cache-home}/build/{workspace-path-hash}". Without these fixes, 1.91 reproduces all of the failures. Newer cargo setsCARGO_BIN_EXE_*at runtime, which hides thecargo_binpart. I tested locally on 1.91 and 1.99.