I run Rust (toolchain stable-x86_64-unknown-linux-gnu) on Linux local machine. My library builds and run fine with my Android app. But I can't run any unit tests if I specify i686-linux-android target.
I can reproduce it on the empty project.
I created the new rust project
cargo new android_test --lib
Set Android NDK ar and linker via /android_test/.cargo/config
[target.i686-linux-android]
ar = "ndk/x86/bin/i686-linux-android-ar"
linker = "ndk/x86/bin/i686-linux-android-clang"
Simple test will success.
cargo test
But it will fail if I set the target triple.
cargo test --target i686-linux-android
Running target/i686-linux-android/debug/deps/android_test-a71bf7c418798cd7 error: could not execute process
/home/zellius/Projects/android_test/target/i686-linux-android/debug/deps/android_test-a71bf7c418798cd7
(never executed) Caused by: No such file or directory (os error 2)
Unit tests will run and pass if I push android_test-a71bf7c418798cd7 file to my Android emulator manually via adb.
I tried to create custom runner. But result is the same.
android_runner.sh
#!/bin/sh
set -e
adb push "$1" "/data/local/tmp/$1"
adb shell "/data/local/tmp/$1"
/android_test/.cargo/config
[target.i686-linux-android]
ar = "ndk/x86/bin/i686-linux-android-ar"
linker = "ndk/x86/bin/i686-linux-android-clang"
runner = ["android_runner.sh"]
Am I missing something? Can I use cargo test to run tests on the emulator? Or should I just use a script for this purpose?