How can I run cargo tests on another machine without the Rust compiler?

Viewed 1497

I know that the compiler can run directly on arm-linux-androideabi, but the Android emulator (I mean emulation of ARM on x86/amd64) is slow, so I don't want to use cargo and rustc on the emulator, I only want to run tests on it.

I want to cross-compile tests on my PC (cargo test --target=arm-linux-androideabi --no-run?), and then upload and run them on emulator, hoping to catch bugs like this.

How can I run cargo test without running cargo test? Is it as simple as running all binaries that were built with cargo test --no-run?

3 Answers

My recommendation for testing on Android would be to use dinghy which provides nice wrapper commands for building and testing on Android/iOS devices/emulator/simulators.

For whoever might still be interested in this: run cargo -v test with -v

Then look for this output

 Finished release [optimized] target(s) in 21.31s
     Running `/my-dir/target/release/deps/my-binary-29b03924d05690f1`  

Then just copy the test binary /my-dir/target/release/deps/my-binary-29b03924d05690f1 to the machine without rustc

Related