-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid_cc_test_wrapper.sh
More file actions
executable file
·44 lines (41 loc) · 961 Bytes
/
android_cc_test_wrapper.sh
File metadata and controls
executable file
·44 lines (41 loc) · 961 Bytes
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
#!/usr/bin/env bash
set -e
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
#echo $SCRIPT_PATH
# the symlink to adb
adb=external/androidsdk/platform-tools/adb
while (( "$#" )); do
if [[ "$1" == "--adb" ]]; then
adb="$2"
shift;shift;
elif [[ "$1" == "--" ]]; then
#end args
shift
break
elif [[ -n "$1" ]]; then
local_file=$1
shift
else
shift
fi
done
if [[ -z "$local_file" ]]; then
echo "No local file for testing?" >&2
exit 1
fi
APP_ARGS=("${@}")
echo ${APP_ARGS[@]}
if [[ -L "$local_file" ]]; then
local_file=`readlink $local_file`
fi
file_name=`basename $local_file`
remote_file=/data/local/tmp/${file_name}
if [[ ! -x "$adb" ]]; then
echo "The adb '$adb' is not executable!" >&2
exit 1
fi
pwd
device=`$adb shell getprop ro.product.device`
echo "Run $file_name on $device..."
$adb push $local_file $remote_file
$adb shell "chmod a+x $remote_file; $remote_file ${APP_ARGS[@]}; rm ${remote_file}"