forked from holochain/tx5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid-run-tests.bash
More file actions
executable file
·83 lines (70 loc) · 1.94 KB
/
Copy pathandroid-run-tests.bash
File metadata and controls
executable file
·83 lines (70 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
set -eEuxo pipefail
if [[ "${ANDROID_API_LEVEL:-x}" == "x" ]]; then
echo "ANDROID_API_LEVEL required"
exit 127
fi
if [[ "${ANDROID_NDK_VERSION:-x}" == "x" ]]; then
echo "ANDROID_NDK_VERSION required"
exit 127
fi
if [[ "${ANDROID_ARCH:-x}" == "x" ]]; then
echo "ANDROID_ARCH required"
exit 127
else
if [[ "${ANDROID_ARCH}" == "arm64-v8a" ]]; then
export ANDROID_ARCH="aarch64"
fi
fi
if [[ "${ANDROID_SDK_ROOT:-x}" == "x" ]]; then
echo "ANDROID_SDK_ROOT required"
exit 127
fi
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION"
ndk_root_folder=""
case "$(uname -m)" in
x86_64) ndk_root_folder="linux-x86_64" ;;
aarch64) ndk_root_folder="linux-aarch64" ;;
*)
echo "Unsupported build host arch: $(uname -m)"
exit 1
;;
esac
case "$ANDROID_ARCH" in
"arm64-v8a")
export ANDROID_ARCH="aarch64"
;;
"armeabi-v7a")
export ANDROID_ARCH="arm"
;;
"x86")
export ANDROID_ARCH="i686"
;;
"x86_64")
export ANDROID_ARCH="x86_64"
;;
*)
echo "Unsupported ANDROID_ARCH: $ANDROID_ARCH"
exit 1
;;
esac
NDK_ROOT="${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/${ndk_root_folder}"
if [ ! -d "$NDK_ROOT" ]; then
echo "NDK_ROOT does not exist: $NDK_ROOT"
exit 1
fi
# get libc++_shared.so path
LIBCPP_SHARED_SO_PATH="${NDK_ROOT}/sysroot/usr/lib/${ANDROID_ARCH}-linux-android/libc++_shared.so"
adb push $LIBCPP_SHARED_SO_PATH /data/local/tmp/
trap 'cleanup' ERR EXIT
cleanup() {
for i in $(cat output-test-executables); do
adb shell rm -f /data/local/tmp/$(basename $i)
done
}
for i in $(cat output-test-executables); do
adb push $i /data/local/tmp/$(basename $i)
adb shell chmod 500 /data/local/tmp/$(basename $i)
adb shell LD_LIBRARY_PATH=/data/local/tmp TX5_CACHE_DIRECTORY=/data/local/tmp/ RUST_LOG=error RUST_BACKTRACE=1 /data/local/tmp/$(basename $i) --test-threads 1 --nocapture
adb shell rm -f /data/local/tmp/$(basename $i)
done