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 build --show-out #12141

Closed
stepancheg opened this issue May 15, 2023 · 3 comments
Closed

cargo build --show-out #12141

stepancheg opened this issue May 15, 2023 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@stepancheg
Copy link
Contributor

Problem

I'm building a test to debug it with debugger, or copy it to another machine if it is build for another architecture.

Where is the binary?

cargo build --tests --verbose

does not print the path. There is a lot of paths with hashes in targets directory, finding the binary with the latest built test is not easy.

Proposed Solution

Either:

  • print binary paths by default (to stderr, so paths are not machine readable, so this is not API change), or
  • add an option cargo build --show-out

Notes

Related to #12140

cargo 1.68.0-nightly (d992ab4e9 2023-01-10)
@stepancheg stepancheg added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels May 15, 2023
@bjorn3
Copy link
Member

bjorn3 commented May 15, 2023

--message-format json prints out artifact messages, which I believe would be enough to get the info you need.

@weihanglo
Copy link
Member

With --no-run, Cargo also emits the executable paths for human. For instance,

$ cargo test --no-run
    Finished test [unoptimized + debuginfo] target(s) in 0.46s
  Executable unittests src/cargo/lib.rs (target/debug/deps/cargo-f8c8ae4254239e92)
  Executable tests/build-std/main.rs (target/debug/deps/build_std-de679ea102561ead)
  Executable tests/internal.rs (target/debug/deps/internal-5b3c0fb3a9e0c0d1)
  Executable tests/testsuite/main.rs (target/debug/deps/testsuite-afcbe389bffe84ae)

Does it meet your needs?

@stepancheg
Copy link
Contributor Author

It does. TIL, thanks!

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` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants