Skip to content

Commit 19667e6

Browse files
Merge pull request #19 from venik/test_on_device
Add -d option to test on a real device
2 parents ddd08e4 + 55e2b81 commit 19667e6

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

run-testsuite.sh

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ BIN=target/net.zetetic.sqlcipher.test.apk
55
INSTALL_ROOT=/data/data/net.zetetic
66
EMULATOR_CHECK_STATUS="adb shell getprop init.svc.bootanim"
77
EMULATOR_IS_BOOTED="stopped"
8-
emulators=`android list avd | awk '/Name:/{print $2}' | sort -u`
9-
for emulator in ${emulators}; do
10-
emulator -avd "${emulator}" -no-skin &> /dev/null &
11-
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
12-
printf "Booting ${emulator}..."
13-
while [[ ${OUT:0:7} != $EMULATOR_IS_BOOTED ]]; do
14-
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
15-
printf "."
16-
sleep 5
17-
done
18-
printf "\n"
19-
8+
9+
function test_sqlcipher {
2010
# unlock
2111
adb shell input keyevent ${UNLOCK_KEY}
2212

@@ -41,11 +31,38 @@ for emulator in ${emulators}; do
4131
OUT=$?
4232
printf "."
4333
done
34+
4435
printf "\nTest suite run complete for ${emulator}:\n"
4536
cat test-results-$emulator.log
4637
printf "\n"
4738
sleep 5
48-
49-
# stop emulator
50-
adb emu kill
51-
done
39+
}
40+
41+
function test_on_emulator {
42+
emulators=`android list avd | awk '/Name:/{print $2}' | sort -u`
43+
44+
for emulator in ${emulators}; do
45+
emulator -avd "${emulator}" -no-skin &> /dev/null &
46+
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
47+
printf "Booting ${emulator}..."
48+
while [[ ${OUT:0:7} != $EMULATOR_IS_BOOTED ]]; do
49+
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
50+
printf "."
51+
sleep 5
52+
done
53+
54+
test_sqlcipher
55+
56+
stop emulator
57+
adb emu kill
58+
done
59+
}
60+
61+
if [ ! -d $1 ]
62+
then
63+
# test on a device
64+
test_sqlcipher
65+
else
66+
# test on an emulator
67+
test_on_emulator
68+
fi

0 commit comments

Comments
 (0)