Skip to content
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

Give path to executables in tests #7108

Closed
nmattia opened this issue Jul 8, 2019 · 1 comment
Closed

Give path to executables in tests #7108

nmattia opened this issue Jul 8, 2019 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@nmattia
Copy link
Contributor

nmattia commented Jul 8, 2019

Describe the problem you are trying to solve

I'm trying to run some of my crate's executables in a test. Currently I have to

  1. Figure out the relative path to target (that path changes depending on whether this is a single crate project (./target) or if the crate is being built as part of a workspace (../target)).
  2. Figure out whether this is a release or debug build by comparing the modification times of the executable.

Describe the solution you'd like

I would like environment variables that tell me

  1. The full path to where the executables are located.
  2. (optionally) Whether this is a debug or release build.

Notes

cargo makes sure that the executables are built before the tests are run, so I believe this doesn't go against cargo best-practices to use freshly-built executables in test, but I'm happy to reconsider.

@nmattia nmattia added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jul 8, 2019
@ehuss
Copy link
Contributor

ehuss commented Jul 8, 2019

Thanks for the report! Issue #5758 is already tracking this, so I'm going to close in favor of that. I'm working on a solution, so hopefully will have something soonish.

@ehuss ehuss closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants