-
Notifications
You must be signed in to change notification settings - Fork 2
test: Added tests from cargo #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
epage
reviewed
Jun 4, 2025
d77131a to
c03ddf3
Compare
Pull Request Test Coverage Report for Build 15496345075Details
💛 - Coveralls |
1bd2c91 to
6ff2c20
Compare
|
Could you clean up the commit history?
|
epage
reviewed
Jun 6, 2025
|
Looks good, thanks for doing this! |
|
Should I make each file as a single commit? |
|
Either way. |
|
Thanks! |
This was referenced Jun 23, 2025
github-merge-queue bot
pushed a commit
to rust-lang/cargo
that referenced
this pull request
Jun 26, 2025
…r Cargo (#15692) ### What does this PR try to resolve? This PR reworks `cargo-test-support` and `testsuite` to use Snapbox's [`cargo_bin!()`](https://docs.rs/snapbox/latest/snapbox/cmd/macro.cargo_bin.html) instead of [`cargo_bin()`](https://docs.rs/snapbox/latest/snapbox/cmd/fn.cargo_bin.html) which makes assumptions about the structure of Cargo's build directory. `cargo_bin!()` uses `CARGO_BIN_EXE_*` for locating the `cargo` binary which should be more resilient to directory/layout changes. Linking a relevant Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cargo_bin_exe.20and.20tests/with/513638220)[#t-cargo > cargo_bin_exe and tests](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cargo_bin_exe.20and.20tests/with/513638220) As shown in that link, we could make these variables available at runtime and not need to do this. However, `cargo-test-support`, as an API, is a bit weird in that it is baking in support for one specific binary. This can be confusing for callers and makes it more annoying for callers provide their own `fn cargo`, e.g. see crate-ci/cargo-fixit#7 ### Implementation Notes `cargo_bin!()` only works when being called from the `testsuite` as it's only set when executing integration tests and `cargo-test-support` is a regular crate. To make this change, I introduced an extension trait `CargoProjectExt` in `testsuite` for running `.cargo()` and implemented it on `Project`. In `cargo-test-support` other functionality relies on `.cargo()` so these also needed to be moved to `testsuite` * [`src/tools.rs`](https://github.com/rust-lang/cargo/blob/master/crates/cargo-test-support/src/tools.rs) * Parts [`src/cross_compile`](https://github.com/rust-lang/cargo/blob/master/crates/cargo-test-support/src/cross_compile.rs) * I had to split this up unfortunately, as `disabled()` requires running Cargo to check if we should disable cross compile tests. * Other fns in `cross_compile` are used in `cargo-test-support` so moving everything to `testsuite` 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
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.
Added tests from https://github.com/rust-lang/cargo/blob/f1bf94d3b2a779d14e2ad6dff43f8d8017583b0d/tests/testsuite/fix.rs
Commented out tests for
EditionTests pass for
fixTests pass for
fix_n_timessorry about commit 553a5e4, forgot to commit my changes before making all the changes