-
Notifications
You must be signed in to change notification settings - Fork 40
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 cargo runner support in order to work with cross #193
Conversation
For this, what you did is good enough |
That should have turned it into a |
It seems to rather be a The proper fix may be to add the runner support in escargot… not sure I'll have the time to do that soon. Would you mind if I change the test to do nothing when running in cross? Something like: diff --git a/tests/cargo.rs b/tests/cargo.rs
index 02ba3dc..35288ab 100644
--- a/tests/cargo.rs
+++ b/tests/cargo.rs
@@ -19,15 +19,19 @@ fn cargo_binary_with_empty_env() {
#[test]
fn mod_example() {
- let bin_under_test = escargot::CargoBuild::new()
- .bin("bin_fixture")
- .current_release()
- .current_target()
- .run()
- .unwrap();
- let mut cmd = bin_under_test.command();
- let output = cmd.unwrap();
- println!("{:?}", output);
+ if std::env::var("CROSS_SYSROOT").is_ok() {
+ // not running this test on cross because escargot doesn't support the cargo target runner yet
+ } else {
+ let bin_under_test = escargot::CargoBuild::new()
+ .bin("bin_fixture")
+ .current_release()
+ .current_target()
+ .run()
+ .unwrap();
+ let mut cmd = bin_under_test.command();
+ let output = cmd.unwrap();
+ println!("{:?}", output);
+ }
}
#[test] That way we can still make sure that the code is compiling for the chosen target, and roll back to the normal behavior once the runner support is added in escargot |
Feel free |
…1420) I'm working on making assert_cmd working with cross. There is one case a bit more difficult: when using `clear_env()` on a process, or `env -i`, the binary is not able to run anymore because the `QEMU_LD_PREFIX` envvar is not set anymore. A (relatively) easy fix might be to ensure in `linux-runner` — and in any other runner — that the necessary environment is configured before running the executable. Something as proposed in this PR for `aarch64-unknown-linux-gnu`. Would that be an acceptable solution? assert-rs/assert_cmd#193
The fix for |
@epage do you see any remaining things to fix in this PR? |
I'm fixing the clippy warning. |
don't run the mod_example test when using cross it depends on escargot also supporting cross, which it doesn't at this time document the runner configuration usage and how to not change anything to run with cross close: assert-rs#139
thanks :-) |
allow to use assert_cmd with cross
cross requires to use a runner to launch the binary. It configures cargo to run the binary
with that runner, so
cargo run --bin foo
works just fine, but assert_cmd doesn't do thatso the execution fails.
to test it on a x86_64 computer, just run
cross -v test --target aarch64-unknown-linux-gnu
Fixes #139