forked from sqlcipher/sqlcipher-android-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-testsuite.sh
More file actions
executable file
·51 lines (44 loc) · 1.55 KB
/
run-testsuite.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.55 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
#! /usr/bin/env bash
UNLOCK_KEY=82
BIN=target/net.zetetic.sqlcipher.test.apk
INSTALL_ROOT=/data/data/net.zetetic
EMULATOR_CHECK_STATUS="adb shell getprop init.svc.bootanim"
EMULATOR_IS_BOOTED="stopped"
emulators=`android list avd | awk '/Name:/{print $2}' | sort -u`
for emulator in ${emulators}; do
emulator @${emulator} -no-skin -no-audio &> /dev/null &
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
printf "Booting ${emulator}..."
while [[ ${OUT:0:7} != $EMULATOR_IS_BOOTED ]]; do
OUT=$($EMULATOR_CHECK_STATUS 2> /dev/null)
printf "."
sleep 5
done
printf "\n"
# unlock
adb shell input keyevent ${UNLOCK_KEY}
# launch and run test suite
printf "Installing test suite\n"
adb install -r ${BIN} &> /dev/null
printf "Running test suite..."
adb shell am start -n "net.zetetic/net.zetetic.TestSuiteActivity" \
-a android.intent.action.MAIN -c android.intent.category.LAUNCHER -e run 1 &> /dev/null
# remove previous test results
adb shell rm ${INSTALL_ROOT}/files/test-results.log &> /dev/null
#poll for test results
adb pull ${INSTALL_ROOT}/files/test-results.log test-results-$emulator.log &> /dev/null
OUT=$?
printf "."
while [[ ${OUT} != 0 ]]; do
sleep 5
adb pull ${INSTALL_ROOT}/files/test-results.log test-results-$emulator.log &> /dev/null
OUT=$?
printf "."
done
printf "\nTest suite run complete for ${emulator}:\n"
cat test-results-$emulator.log
printf "\n"
sleep 5
# stop emulator
adb emu kill
done