Merge lp:~xnox/ubuntu-test-cases/touch-emulator into lp:ubuntu-test-cases/touch

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: lp:~xnox/ubuntu-test-cases/touch-emulator
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 161 lines (+130/-1)
5 files modified
scripts/custom-py3.sh (+18/-0)
scripts/provision-emulator.sh (+23/-0)
scripts/run-test.sh (+60/-0)
scripts/run-tests.sh (+28/-0)
utils/target/unlock_screen.sh (+1/-1)
To merge this branch: bzr merge lp:~xnox/ubuntu-test-cases/touch-emulator
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+200448@code.launchpad.net

Description of the change

Basic support for running autopilot tests in the emulator:

* doesn't reboot, instead uses snapshots to revert into pristine image
* doesn't use wait for settled logic
* uses "blind" screen unlock
* no support for utah tests just yet (haven't even tried)
* works on desktops / servers / headless / gpuless cloud-instances
* needs about 10GB of disk-space + 1GB of RAM

./scripts/provision-emulator.sh

./scripts/run-tests.sh # for all
./scripts/run-test.sh click com.ubuntu.weather ubuntu_weather_app # for individual test

Please review & hopefully start adding emulator test results to jenkins.

To post a comment you must log in.
133. By Dimitri John Ledkov

Force install

134. By Dimitri John Ledkov

Move display setup into the test-runner.

135. By Dimitri John Ledkov

30s timeout

136. By Dimitri John Ledkov

Let locale & source pam environment.

137. By Dimitri John Ledkov

Add startup watchdog.

138. By Dimitri John Ledkov

Add shorts

139. By Dimitri John Ledkov

Add apt-get update, before apt-get install. Thanks barry.

140. By Dimitri John Ledkov

Add support for custom.sh scripts to customize base image.

141. By Dimitri John Ledkov

Add example custom script to run custom tests with autopilot-python3

142. By Dimitri John Ledkov

Add unity8

143. By Dimitri John Ledkov

Merge Apply matching kill timeout in local unity8.override.

144. By Dimitri John Ledkov

Port to ubuntu-emulator.

Revision history for this message
Andy Doan (doanac) wrote :

I've been working off your branch to come up with a way to really include this in our CI process. I'm starting to get something standing itself up with:

 https://code.launchpad.net/~doanac/ubuntu-test-cases/touch-emulator-support

I'm using our staging jenkins instance to start exploring more:

 http://dev-jenkins:8080/job/trusty-touch-emulator-smoke-daily/3

I'll probably have some questions for you tomorrow. For example, the autopilot patches are applying anymore, but I might be able to figure that out.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

On 14 February 2014 00:36, Andy Doan <email address hidden> wrote:
> I've been working off your branch to come up with a way to really include this in our CI process. I'm starting to get something standing itself up with:
>
> https://code.launchpad.net/~doanac/ubuntu-test-cases/touch-emulator-support
>
> I'm using our staging jenkins instance to start exploring more:
>
> http://dev-jenkins:8080/job/trusty-touch-emulator-smoke-daily/3
>
> I'll probably have some questions for you tomorrow. For example, the autopilot patches are applying anymore, but I might be able to figure that out.

With recent enough autopilot, patches shouldn't be required.

Also i had a branch which uses "ubuntu-emulator" instead shell scripts:
see https://code.launchpad.net/~xnox/ubuntu-test-cases/ubuntu-emulator

With that one, it's easier to request a particular image REVNO to be setup.

Also i'm travelling tomorrow, so my replies might be scarce. Feel free
to send me emails, and I'll try to reply to them, when i can.

--
Regards,

Dimitri.

Unmerged revisions

144. By Dimitri John Ledkov

Port to ubuntu-emulator.

143. By Dimitri John Ledkov

Merge Apply matching kill timeout in local unity8.override.

142. By Dimitri John Ledkov

Add unity8

141. By Dimitri John Ledkov

Add example custom script to run custom tests with autopilot-python3

140. By Dimitri John Ledkov

Add support for custom.sh scripts to customize base image.

139. By Dimitri John Ledkov

Add apt-get update, before apt-get install. Thanks barry.

138. By Dimitri John Ledkov

Add shorts

137. By Dimitri John Ledkov

Add startup watchdog.

136. By Dimitri John Ledkov

Let locale & source pam environment.

135. By Dimitri John Ledkov

30s timeout

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'scripts/custom-py3.sh'
2--- scripts/custom-py3.sh 1970-01-01 00:00:00 +0000
3+++ scripts/custom-py3.sh 2014-03-03 16:38:18 +0000
4@@ -0,0 +1,18 @@
5+#!/bin/sh
6+
7+adb -s $ANDROID_SERIAL shell DEBIAN_FRONTEND=noninteractive apt-get -y -q install python3-autopilot python3-evdev
8+
9+adb -s $ANDROID_SERIAL shell cp /usr/bin/autopilot-py3 /usr/bin/autopilot
10+
11+adb -s $ANDROID_SERIAL shell ls /home/phablet/autopilot
12+
13+rm -rf autopilot; mkdir -p autopilot
14+bzr export autopilot/address_book_app lp:~barry/ubuntu/trusty/address-book-app/py3ap/tests/autopilot/address_book_app
15+bzr export autopilot/camera_app lp:~barry/ubuntu/trusty/camera-app/py3ap/tests/autopilot/camera_app
16+bzr export autopilot/cordova_ubuntu lp:~barry/ubuntu/trusty/cordova-ubuntu-tests/py3ap/tests/autopilot/cordova_ubuntu
17+
18+adb -s $ANDROID_SERIAL push autopilot /home/phablet/autopilot
19+
20+adb -s $ANDROID_SERIAL shell ls /home/phablet/autopilot
21+
22+adb -s $ANDROID_SERIAL shell chown -R phablet: /home/phablet/autopilot
23
24=== added file 'scripts/provision-emulator.sh'
25--- scripts/provision-emulator.sh 1970-01-01 00:00:00 +0000
26+++ scripts/provision-emulator.sh 2014-03-03 16:38:18 +0000
27@@ -0,0 +1,23 @@
28+#!/bin/sh
29+set -x
30+set -e
31+
32+BASEDIR=$(dirname $(readlink -f $0))
33+
34+RESDIR=`pwd`/clientlogs
35+
36+pkgs="ubuntu-emulator xvfb xinit phablet-tools"
37+pkgn=4
38+
39+check=`dpkg-query -W $pkgs | wc -l`
40+
41+if [ "$check" != "$pkgn" ]
42+then
43+sudo dpkg --add-architecture i386
44+sudo sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list
45+sudo apt-get update
46+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y $pkgs
47+fi
48+
49+sudo ubuntu-emulator destroy jemjem || true
50+sudo ubuntu-emulator create jemjem
51
52=== added file 'scripts/run-test.sh'
53--- scripts/run-test.sh 1970-01-01 00:00:00 +0000
54+++ scripts/run-test.sh 2014-03-03 16:38:18 +0000
55@@ -0,0 +1,60 @@
56+#!/bin/sh
57+set -x
58+
59+BASEDIR=$(dirname $(readlink -f $0))
60+
61+setup_emulator() {
62+
63+ for j in `seq 3`
64+ do
65+ killall emulator-arm
66+
67+ ubuntu-emulator snapshot --revert-pristine jemjem
68+
69+ ubuntu-emulator run jemjem &
70+
71+ adb wait-for-device
72+ sleep 160
73+
74+ for i in `seq 10`
75+ do
76+ sleep 10
77+ adb shell sudo -i -u phablet status unity8 | grep -q start/running && break 2
78+ done
79+
80+ echo "Error: Emulator failed to fully boot"
81+
82+ [ "$j" = "3" ] && { echo "Error: Giving up"; exit; }
83+ done
84+
85+ phablet-config edges-intro --disable
86+ phablet-config autopilot --dbus-probe enable
87+ adb push ${BASEDIR}/../utils/target /home/phablet/bin
88+ ci_version=$(ubuntu-emulator list | grep jemjem | cut -f2)
89+ adb shell "echo $ci_version > /home/phablet/.ci-version"
90+}
91+
92+if [ -z "$DISPLAY" ]
93+then
94+ startx -- /usr/bin/Xvfb :1 -screen 0 1024x768x24 &
95+ export DISPLAY=:1
96+ sleep 10
97+fi
98+
99+date
100+setup_emulator
101+serial=$(adb get-serialno)
102+
103+if [ "click" = "$1" ]
104+then
105+ phablet-click-test-setup -s $serial --click $2
106+else
107+ adb shell DEBIAN_FRONTEND=noninteractive apt-get update
108+ adb shell DEBIAN_FRONTEND=noninteractive apt-get -y -q install $2
109+fi
110+
111+[ -x custom.sh ] && ANDROID_SERIAL=$serial ./custom.sh
112+
113+${BASEDIR}/run-autopilot-tests.sh -s $serial -a $3 -Q -S
114+date
115+killall emulator-arm
116
117=== added file 'scripts/run-tests.sh'
118--- scripts/run-tests.sh 1970-01-01 00:00:00 +0000
119+++ scripts/run-tests.sh 2014-03-03 16:38:18 +0000
120@@ -0,0 +1,28 @@
121+#!/bin/sh
122+set -x
123+
124+BASEDIR=$(dirname $(readlink -f $0))
125+
126+${BASEDIR}/run-test.sh deb unity8-autopilot unity8
127+${BASEDIR}/run-test.sh deb address-book-app-autopilot address_book_app
128+${BASEDIR}/run-test.sh deb camera-app-autopilot camera_app
129+${BASEDIR}/run-test.sh deb cordova-ubuntu-autopilot cordova_ubuntu
130+${BASEDIR}/run-test.sh deb dialer-app-autopilot dialer_app
131+${BASEDIR}/run-test.sh deb gallery-app-autopilot gallery_app
132+${BASEDIR}/run-test.sh deb friends-app-autopilot friends_app
133+${BASEDIR}/run-test.sh deb ubuntu-keyboard-autopilot ubuntu_keyboard
134+${BASEDIR}/run-test.sh deb ubuntu-system-settings-autopilot ubuntu_system_settings
135+${BASEDIR}/run-test.sh deb ubuntu-ui-toolkit-autopilot ubuntuuitoolkit
136+${BASEDIR}/run-test.sh deb unity-webapps-qml-autopilot unity_webapps_qml
137+${BASEDIR}/run-test.sh deb webbrowser-app-autopilot webbrowser_app
138+
139+${BASEDIR}/run-test.sh click com.ubuntu.calculator ubuntu_calculator_app
140+${BASEDIR}/run-test.sh click com.ubuntu.calendar calendar_app
141+${BASEDIR}/run-test.sh click com.ubuntu.clock ubuntu_clock_app
142+${BASEDIR}/run-test.sh click com.ubuntu.dropping-letters dropping_letters_app
143+${BASEDIR}/run-test.sh click com.ubuntu.filemanager ubuntu_filemanager_app
144+${BASEDIR}/run-test.sh click com.ubuntu.music music_app
145+${BASEDIR}/run-test.sh click com.ubuntu.notes notes_app
146+${BASEDIR}/run-test.sh click com.ubuntu.terminal ubuntu_terminal_app
147+${BASEDIR}/run-test.sh click com.ubuntu.weather ubuntu_weather_app
148+${BASEDIR}/run-test.sh click com.ubuntu.shorts ubuntu_rssreader_app
149
150=== modified file 'utils/target/unlock_screen.sh'
151--- utils/target/unlock_screen.sh 2013-11-01 17:07:18 +0000
152+++ utils/target/unlock_screen.sh 2014-03-03 16:38:18 +0000
153@@ -2,7 +2,7 @@
154
155 basedir=$(dirname $(readlink -f $0))
156
157-sudo -i -u phablet bash -ic "PYTHONPATH=$(pwd) ${basedir}/unlock_screen.py"
158+sudo -i -u phablet bash -ic "PYTHONPATH=$(pwd) ${basedir}/unlock_screen.py -q"
159 rc=$?
160
161 exit $rc

Subscribers

People subscribed via source and target branches