~fginther/+junk/remove-unlock

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
#!/bin/bash
set -x

PACKAGES='phone-app-autopilot camera-app-autopilot gallery-app-autopilot share-app-autopilot
mediaplayer-app-autopilot webbrowser-app-autopilot notes-app-autopilot ubuntu-terminal-app-autopilot
ubuntu-clock-app-autopilot music-app-autopilot ubuntu-filemanager-app-autopilot'
TESTSUITES='phone_app camera_app gallery_app share_app notes_app mediaplayer_app webbrowser_app
ubuntu_terminal_app ubuntu_clock_app music_app ubuntu_filemanager_app'

if [ -z "$1" ]
then
    echo "You have to pass a device serial"
    echo "$0 04bf2c50e294d599"
    exit -1
fi

exec_with_adb() { 
    adb -s $ANDROID_SERIAL shell "$@"
}

exec_with_adb_user() {
	adb -s $ANDROID_SERIAL shell sudo -u phablet -i bash -ic "$@"
}

install_packages() {
	exec_with_adb apt-get update
	exec_with_adb apt-get install -y autopilot-touch $PACKAGES openssh-server
}

ANDROID_SERIAL=$1

adb -s $ANDROID_SERIAL reboot
adb -s $ANDROID_SERIAL wait-for-device
sleep 60
exec_with_adb "nmcli dev wifi connect ubuntu-qa-g-wpa password qalabwireless"

install_packages

#temporary workaround, as there is a bug due to which ueventd consumes
#100% cpu so screen does not unlock.
exec_with_adb pkill ueventd

exec_with_adb chmod 666 /dev/uinput
adb -s $ANDROID_SERIAL push autopilot_executer/unlock_screen.py /home/phablet
exec_with_adb_user /home/phablet/unlock_screen.py

for suite in $TESTSUITES
do
    adb -s $ANDROID_SERIAL shell sudo -u phablet -i bash -ic "autopilot run -o /tmp/${suite}_results.xml -f xml $suite"
    adb -s $ANDROID_SERIAL pull /tmp/${suite}_results.xml .
done