-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathemulator-android.sh
executable file
·53 lines (47 loc) · 1.07 KB
/
emulator-android.sh
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
#!/bin/sh
# Usage:
# emulator-android.sh --adb-push DIR
# emulator-android.sh --adb-pull DIR
# emulator-android.sh TESTCASE [ARGS...]
ADB="$ANDROID_HOME/platform-tools/adb"
REMOTE_DIR="/data/local/tmp"
LOG="log.txt"
setupLog() {
echo "---" >> $LOG
echo args: "$@" >> $LOG
echo pwd: $PWD >> $LOG
echo log: >> $LOG
}
if [ "$1" = "--adb-push" ] ; then
cd "$2"
setupLog "$@"
echo "--adb-push: do nothing" >> $LOG
exit
fi
if [ "$1" = "--adb-pull" ] ; then
cd "$2"
setupLog "$@"
echo "--adb-pull: do nothing" >> $LOG
exit
fi
setupLog "$@"
name="$1"
if [ "${name##*/}" != "testsuite" ] ; then
echo unexpected testcase >> $LOG
exit 1
fi
shift
if [ "$1" = "--gtest_list_tests" ] ; then
echo devices: >> $LOG
$ADB devices >> $LOG
$ADB push testsuite $REMOTE_DIR/testsuite >> $LOG
$ADB shell chmod 755 $REMOTE_DIR/testsuite >> $LOG
fi
n="'"
args=$n$1$n
shift
for i in "$@" ; do
args="$args $n$i$n"
done
echo $ADB shell "cd $REMOTE_DIR && ./testsuite $args" >> $LOG
$ADB shell "cd $REMOTE_DIR && ./testsuite $args"