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

build test binary with cargo rustc #2120

Closed
danburkert opened this issue Nov 6, 2015 · 5 comments
Closed

build test binary with cargo rustc #2120

danburkert opened this issue Nov 6, 2015 · 5 comments

Comments

@danburkert
Copy link

It's currently not possible to package a test binary using cargo rustc, which can be useful when cross compiling a test binary.

@alexcrichton
Copy link
Member

Does passing --test to rustc work?

@danburkert
Copy link
Author

No, or at least I don't think so. --test takes a test target, but I don't know how to specify the target as the libraries in-source tests.

@alexcrichton
Copy link
Member

Ah I meant along the lines of:

cargo rustc --lib -- --test

(e.g. passing --test to rustc, not cargo)

@danburkert
Copy link
Author

I tried that, but it fails at that point to link dev dependencies. Perhaps
there's a workaround to force cargo to link in the dev dependencies with
cargo rustc?

On Fri, Nov 6, 2015 at 11:35 AM, Alex Crichton [email protected]
wrote:

Ah I meant along the lines of:

cargo rustc --lib -- --test

(e.g. passing --test to rustc, not cargo)


Reply to this email directly or view it on GitHub
#2120 (comment).

@alexcrichton
Copy link
Member

Ah, right yes of course! Currently there's no way to work around that, but I have also wanted this in the past!

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Dec 17, 2015
This should allow compiling the specified target in the various profiles that
are available to it, e.g. bench or test in addition to the standard
dev.

Closes rust-lang#2120
bors added a commit that referenced this issue Dec 18, 2015
This should allow compiling the specified target in the various profiles that
are available to it, e.g. bench or test in addition to the standard
dev.

Closes #2120
JIghtuse pushed a commit to JIghtuse/cargo that referenced this issue Dec 22, 2015
This should allow compiling the specified target in the various profiles that
are available to it, e.g. bench or test in addition to the standard
dev.

Closes rust-lang#2120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants