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

cargo test --no-run doesn't appear to produce a binary #8525

Closed
iostat opened this issue Jul 21, 2020 · 4 comments
Closed

cargo test --no-run doesn't appear to produce a binary #8525

iostat opened this issue Jul 21, 2020 · 4 comments
Labels
C-bug Category: bug

Comments

@iostat
Copy link

iostat commented Jul 21, 2020

Problem

Running cargo test --no-run doesn't seem to produce a binary in target/debug like it used to. While it does appear to "compile, but not run tests" as advertised, the output of this compilation is nowhere to be found. Previously, it could be found in target/debug/crate_name-some_build_hash

Steps

  1. Clean your target directory
  2. Run cargo test --no-run
  3. Cargo will appear to build your test suite /somewhere/, but that somewhere isn't in target/debug like it used to be, nor is it anywhere immediately obvious within the target/debug/build subdirectories
  4. Check target/debug, and find that there are no binaries to be found

Possible Solution(s)
Restoring the behavior where it would put the binary into target/debug would be ideal. However it may make more sense to have a separate target/test or something along those lines as well. Essentially, there appears to currently be no way to manually invoke a test binary so that test results can be parsed and stored in CI-friendly formats (e.g. JUnit as cargo-suity does)

Notes

Output of cargo version:
cargo 1.46.0-nightly (4f74d9b2a 2020-07-08)
with rustup toolchain nightly-2020-07-12. This is confirmed to be happening on macOS 10.15.4 and Ubuntu 19.10

@iostat iostat added the C-bug Category: bug label Jul 21, 2020
@iostat
Copy link
Author

iostat commented Jul 21, 2020

nb: this change might've been intentional, in which case, maybe treat it as a feature request?

@iostat iostat changed the title cargo test --no-run doesn't produce a binary cargo test --no-run doesn't appear to produce a binary Jul 21, 2020
@iostat
Copy link
Author

iostat commented Jul 21, 2020

on futher inspection, it appears to be emitted to target/debug/deps/<crate_name>-<some_build_hash> Maybe we can reframe this as a feature request to emit as target/debug/<crate_name>-test or something along those lines?

@ehuss
Copy link
Contributor

ehuss commented Jul 21, 2020

For now, the intent is to use --message-format=json to get the path to the file to execute the tests. I think the following issues match your feature request: #1924, #3670

@ehuss
Copy link
Contributor

ehuss commented Jul 29, 2020

Closing as a duplicate per the comment above.

@ehuss ehuss closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants