Rework cargo-test-support
& testsuite
to use CARGO_BIN_EXE_*
for Cargo
#15692
+1,099
−446
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.
What does this PR try to resolve?
This PR reworks
cargo-test-support
andtestsuite
to use Snapbox'scargo_bin!()
instead ofcargo_bin()
which makes assumptions about the structure of Cargo's build directory.cargo_bin!()
usesCARGO_BIN_EXE_*
for locating thecargo
binary which should be more resilient to directory/layout changes.Linking a relevant Zulip discussion here#t-cargo > cargo_bin_exe and tests
Implementation Notes
cargo_bin!()
only works when being called from thetestsuite
as it's only set when executing integration tests andcargo-test-support
is a regular crate.To make this change, I introduced an extension trait
CargoProjectExt
intestsuite
for running.cargo()
and implemented it onProject
.In
cargo-test-support
other functionality relies on.cargo()
so these also needed to be moved totestsuite
src/tools.rs
src/cross_compile
disabled()
requires running Cargo to check if we should disable cross compile tests.cross_compile
are used incargo-test-support
so moving everything totestsuite
would have ended up requiring moving many things to test suite.How to test and review this PR?
I'd definitely recommend reviewing commit by commit.
There are a lot of diffs due to the nature of reorganizing things.
I did my best to split things things into smaller PRs but they still contain a lot of
use
statement diffs.r? @epage