-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add option to configure a test/binary runner #1411
Comments
(Though in my case I created a project that allows me to run PNaCl pexes just like one would run a Additionally, we may want to go the extra step and create environment configuration/profiles. For example, there are two different runtime environments for NaCl: the basic sandbox and the sandbox+ppapi (ie hosted in a webpage in chrome). To sum up (test environment profiles tbd): [target.le32-unknown-nacl.test-proxy]
package = "crate id thingy w/ optional version"
# or:
command = "..." Granted this runs afoul crates.io's library only limitation. |
I'd definitely love to support something like this, but I'm not certain that the interface should be "run this program with some arguments". As @DiamondLovesYou mentions it'd also be nice to farm out this functionality to crates.io wherever possible (aka see build scripts as well!). Right now |
Please, don't let the perfect be the enemy of the good. "run this program", or rather "prefix the command with this" is totally sufficient. Keep in mind this is the global configuration, not the crate one. The user must go and explicitly set it when configuring their development environment. So even if the command is provided via crate, asking the user to In fact:
But in all cases, ultimately it will always be prefixing the executable with an interpreter. So it makes sense to do it the simple way and perhaps later add some more sugar on top. |
When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument. This allows to run tests when cross-comping Rust projects. This is not a complete solution, and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from command line, but it should already unlock major existing usecases. Fixes rust-lang#1411 Resolves rust-lang#3626
Add support for custom target-specific runners When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument. This allows to run tests when cross-comping Rust projects. This is not a complete solution and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from the command line, but it should already unlock major existing use cases. Fixes #1411 Resolves #3626
Add support for custom target-specific runners When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument. This allows to run tests when cross-comping Rust projects. This is not a complete solution and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from the command line, but it should already unlock major existing use cases. Fixes #1411 Resolves #3626
Cargo can be configured to cross-compile to specific target with
this correctly sets up the cross-compiler, but then when I try
cargo test --target <triple>
, it simply tries to run the built binaries, which for most cross-compilations won't work. However in many cases there is a way to run the tests. When cross-compiling to Windows, they can be run viawine
, NaCl has it's own tools for running binaries, for Android script can be written to connect to emulator and run the tests there and so on.So I'd like to propose adding another key in the target for running binaries. Cargo would then simply prefix commands to execute built binaries with it's content. It should probably be called
run
orlaunch
and apply to all commands that run built binaries:test
,bench
andrun
.So for example Windows would be configured as:
The text was updated successfully, but these errors were encountered: