You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(test): Make CARGO_BIN_EXE_ available at runtime
This also makes artifact deps available for consistency purposes.
I originally proposed this for when moving Cargo off of Cargo's own
internals but went with a different solution.
Re-visiting this because `assert_cmd` has 2300+ dependents and it seems
like making `assert_cmd::cargo_bin` work would be a better use of time
than migrating all of those users to `assert_cmd::cargo_bin!`.
For example, within the top 130 dependents (100,000 downloads or more),
I found 66 that used `assert_cmd::cargo_bin`
(rust-lang/rust#149852).
> The reason to make `CARGO_BIN_EXE` set only at build-time was to
> address the concern of manually running the test executable.
> It's not
> too common for tests to look at any runtime environment variables
> (that I know of), so it usually just works (like running
> `gdb target/debug/.../test-xxx`).
> The concern was that if it were set at
> runtime it would move more down the path where directly running the test
> executable doesn't "just work".
See https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cargo_bin_exe.20and.20tests/near/513638220
However,
- This is user opt-in
- Users can run with `-vv` to see the env variables that are set
- Users can run `CARGO_TARGET_..._RUNNER=gdb`
- We can notify the `cargo nextest`, the main third-party test runner,
about this. It should be easy to support as they have their own
version of this, see https://nexte.st/docs/configuration/env-vars/?h=nextest_bin_exe#environment-variables-nextest-sets
0 commit comments