Merge lp:~canonical-platform-qa/ubuntu-ota-tests/upgrade into lp:ubuntu-ota-tests
- upgrade
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Leo Arias |
Approved revision: | 26 |
Merged at revision: | 6 |
Proposed branch: | lp:~canonical-platform-qa/ubuntu-ota-tests/upgrade |
Merge into: | lp:ubuntu-ota-tests |
Prerequisite: | lp:~canonical-platform-qa/ubuntu-ota-tests/check-for-running-service |
Diff against target: |
555 lines (+503/-0) 7 files modified
adb-reboot-to-recovery (+337/-0) debian/tests/control (+6/-0) debian/tests/ubuntu_ota_tests/__init__.py (+4/-0) debian/tests/ubuntu_ota_tests/hooks.py (+60/-0) debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py (+34/-0) debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py.THIS (+34/-0) debian/tests/ubuntu_ota_tests/upgrade.py (+28/-0) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-ota-tests/upgrade |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Christopher Lee (community) | Approve | ||
Federico Gimenez (community) | Approve | ||
Brendan Donegan | Pending | ||
Review via email: mp+252372@code.launchpad.net |
Commit message
Added an initial upgrade test.
Description of the change
Flash with:
ubuntu-device-flash --revision=-1 touch --developer-mode --password 0000 --channel=
Run with:
adt-run -d -B --unbuilt-tree=. --output-dir /tmp/output --- ssh -s ./adb-reboot-
The adb-reboot-
Leo Arias (elopio) wrote : | # |
Christopher Lee (veebers) wrote : | # |
Just a couple of comments re: docs and logging. The code looks really good.
A note that we really need to get adb-reboot-
I attempted to run the code but experienced what looked like a timeout error (Potentially due to the internet connection issues I currently have, will try again later tonight.)
If other people can successfully run this code then I would say this would be an approve (if the mentioned documentation is added) as we can iterate on the failure issue.
Christopher Lee (veebers) wrote : | # |
Running it again with decent internet passes. I say we tackle this in a different branch (if we tackle it at all).
Federico Gimenez (fgimenez) wrote : | # |
Worked just fine, +1
Leo Arias (elopio) wrote : | # |
Thanks for the reviews. I added the comments and logging.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https:/
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === added file 'adb-reboot-to-recovery' |
2 | --- adb-reboot-to-recovery 1970-01-01 00:00:00 +0000 |
3 | +++ adb-reboot-to-recovery 2015-03-12 16:11:21 +0000 |
4 | @@ -0,0 +1,337 @@ |
5 | +#!/bin/sh |
6 | + |
7 | +# adb.ssh is part of autopkgtest |
8 | +# autopkgtest is a tool for testing Debian binary packages |
9 | +# |
10 | +# This script sets up an ssh connection to an adb host. If that adb host is an |
11 | +# Ubuntu Touch system, it also does some extra configuration like disabling the |
12 | +# screen timeout and allowing Autopilot to introspect running apps. |
13 | +# |
14 | +# Options: |
15 | +# -r/--reset Do a factory reset of the device before running the test |
16 | +# (Available on Ubuntu Phone only; disabled for now as it does not |
17 | +# re-enable developer mode) |
18 | +# -b/--reboot Reboot the device before running the test |
19 | +# -s serial | --serial=serial |
20 | +# Serial ID of the device as returned by adb devices -l when |
21 | +# several devices are connected to the same host. |
22 | +# -p PASSWORD | --password PASSWORD |
23 | +# sudo password; if not given, tries "phablet" and "0000"; if |
24 | +# neither works, tests cannot run as root |
25 | +# |
26 | +# autopkgtest is Copyright (C) 2006-2014 Canonical Ltd. |
27 | +# |
28 | +# Author: Jean-Baptiste Lallement <jean-baptiste.lallement@canonical.com> |
29 | +# |
30 | +# This program is free software; you can redistribute it and/or modify |
31 | +# it under the terms of the GNU General Public License as published by |
32 | +# the Free Software Foundation; either version 2 of the License, or |
33 | +# (at your option) any later version. |
34 | +# |
35 | +# This program is distributed in the hope that it will be useful, |
36 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
37 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
38 | +# GNU General Public License for more details. |
39 | +# |
40 | +# You should have received a copy of the GNU General Public License |
41 | +# along with this program; if not, write to the Free Software |
42 | +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
43 | +# |
44 | +# See the file CREDITS for a full list of credits information (often |
45 | +# installed as /usr/share/doc/autopkgtest/CREDITS). |
46 | +set -e |
47 | + |
48 | +SSH_USER=phablet |
49 | +SUDO_PASSWORD= |
50 | +CAPABILITIES='isolation-machine reboot' |
51 | + |
52 | +# allow using lp:phablet-tools from a checkout |
53 | +if [ -n "$PHABLET_TOOLS_PATH" ]; then |
54 | + export PATH="$PHABLET_TOOLS_PATH:$PATH" |
55 | +fi |
56 | + |
57 | +# argument parsing |
58 | +ADBOPTS="" |
59 | +RESET="" |
60 | +REBOOT="" |
61 | +IDENTITY= |
62 | + |
63 | +open() { |
64 | + # Setup a connection to an adb device |
65 | + # - Configure ssh connection |
66 | + # - optionally mount device RW |
67 | + wait_booted |
68 | + |
69 | + if [ -n "$REBOOT" ]; then |
70 | + adb $ADBOPTS reboot |
71 | + wait_booted |
72 | + fi |
73 | + |
74 | + # special setup on Ubuntu images |
75 | + if [ -n "$(adb $ADBOPTS shell 'type unity8 2>/dev/null')" ]; then |
76 | + if [ -n "$RESET" ]; then |
77 | + revert |
78 | + else |
79 | + ubuntu_prepare_config |
80 | + ubuntu_prepare_for_testing |
81 | + fi |
82 | + #CAPABILITIES="$CAPABILITIES revert" |
83 | + fi |
84 | + |
85 | + |
86 | + # Configure SSH |
87 | + adb $ADBOPTS shell 'gdbus call -y -d com.canonical.PropertyService -o /com/canonical/PropertyService -m com.canonical.PropertyService.SetProperty ssh true >/dev/null' |
88 | + for port in `seq 2222 2299`; do |
89 | + adb $ADBOPTS forward tcp:$port tcp:22 && break |
90 | + done |
91 | + |
92 | + # Purge the device host key so that SSH doesn't print a scary warning about it |
93 | + # (it changes every time the device is reflashed and this is expected) |
94 | + ssh-keygen -f ~/.ssh/known_hosts -R [localhost]:$PORT 2>/dev/null || true |
95 | + |
96 | + # Copy your ssh id down to the device so you never need a password. |
97 | + IDENTITY=$HOME/.ssh/id_rsa |
98 | + if [ ! -e $IDENTITY ]; then |
99 | + IDENTITY=$HOME/.ssh/id_autopkgtest |
100 | + if [ ! -e $IDENTITY ]; then |
101 | + echo "No default ssh key, generating $IDENTITY" >&2 |
102 | + ssh-keygen -q -t ed25519 -f $IDENTITY -N '' |
103 | + fi |
104 | + fi |
105 | + script=$(mktemp /tmp/$(basename $0).XXXXXX) |
106 | + adb $ADBOPTS push ${IDENTITY}.pub /home/$SSH_USER/.ssh/authorized_keys |
107 | + cat>$script <<EOF |
108 | +# Set right permissions |
109 | +chown $SSH_USER:$SSH_USER -R /home/$SSH_USER/.ssh/ |
110 | +chmod 700 /home/$SSH_USER/.ssh |
111 | +chmod 600 /home/$SSH_USER/.ssh/authorized_keys |
112 | +EOF |
113 | + |
114 | + adb $ADBOPTS push $script /tmp |
115 | + adb $ADBOPTS shell sh $script |
116 | + adb $ADBOPTS shell rm $script |
117 | + rm $script |
118 | + |
119 | + # verify that we can connect through ssh |
120 | + local ssh_cmd="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $IDENTITY -p $port -l $SSH_USER localhost" |
121 | + for retry in `seq 10`; do |
122 | + if $ssh_cmd true; then |
123 | + can_ssh=1 |
124 | + break |
125 | + fi |
126 | + sleep 2 |
127 | + done |
128 | + if [ -z "$can_ssh" ]; then |
129 | + echo "ssh setup failed, cannot connect" >&2 |
130 | + exit 1 |
131 | + fi |
132 | + |
133 | + # try to auto-detect sudo password from common ones used by CI |
134 | + for p in phablet 0000; do |
135 | + if $ssh_cmd "echo $p | sudo -S true" >/dev/null 2>&1; then |
136 | + SUDO_PASSWORD="$p" |
137 | + break |
138 | + fi |
139 | + done |
140 | + |
141 | + # print info for adt-virt-ssh |
142 | + cat<<EOF |
143 | +login=$SSH_USER |
144 | +hostname=localhost |
145 | +port=$port |
146 | +capabilities=$CAPABILITIES |
147 | +identity=$IDENTITY |
148 | +extraopts=--no-reset --fwd-port=$port |
149 | +EOF |
150 | + if [ -n "$SUDO_PASSWORD" ]; then |
151 | + echo "password=$SUDO_PASSWORD" |
152 | + fi |
153 | +} |
154 | + |
155 | +wait_booted() { |
156 | + echo "Waiting for device ADB to appear..." >&2 |
157 | + if ! timeout 300 adb $ADBOPTS wait-for-device >/dev/null; then |
158 | + echo "ERROR: Timed out waiting for adb device" >&2 |
159 | + fi |
160 | +} |
161 | + |
162 | +# configure Ubuntu device for testing |
163 | +ubuntu_prepare_config() { |
164 | + if [ -z "$(adb $ADBOPTS shell 'type unity8 2>/dev/null')" ]; then |
165 | + # not an Ubuntu phone |
166 | + return |
167 | + fi |
168 | + |
169 | + if ! type phablet-config >/dev/null 2>&1; then |
170 | + echo "ERROR: phablet-config not found! Install phablet-tools package or" >&2 |
171 | + echo "bzr branch lp:phablet-tools and run with PHABLET_TOOLS_PATH=<checkout dir>" >&2 |
172 | + exit 1 |
173 | + fi |
174 | + |
175 | + echo "Configuring Ubuntu phone for testing..." >&2 |
176 | + |
177 | + # disable first-time wizards; these fail due to adb instability from time |
178 | + # to time, so retry |
179 | + for retry in `seq 5`; do |
180 | + if phablet-config $ADBOPTS welcome-wizard --disable >/dev/null; then |
181 | + break |
182 | + else |
183 | + echo "Failed to disable welcome wizard, retrying (attempt $retry)..." >&2 |
184 | + sleep 1 |
185 | + fi |
186 | + done |
187 | + # this needs accounts-daemon running |
188 | + adb $ADBOPTS shell 'while ! pidof accounts-daemon >/dev/null; do sleep 1; done' |
189 | + for retry in `seq 5`; do |
190 | + if phablet-config $ADBOPTS edges-intro --disable >/dev/null; then |
191 | + break |
192 | + else |
193 | + echo "Failed to disable edges intro, retrying (attempt $retry)..." >&2 |
194 | + sleep 1 |
195 | + fi |
196 | + done |
197 | + |
198 | + # kill an already running welcome wizard |
199 | + adb $ADBOPTS shell 'kill `pidof system-settings-wizard` 2>/dev/null' |
200 | +} |
201 | + |
202 | +# test run time setup for Ubuntu device |
203 | +ubuntu_prepare_for_testing() { |
204 | + if [ -z "$(adb $ADBOPTS shell 'type unity8 2>/dev/null')" ]; then |
205 | + # not an Ubuntu phone |
206 | + return |
207 | + fi |
208 | + |
209 | + echo "Preparing Ubuntu phone for running tests..." >&2 |
210 | + |
211 | + echo "Waiting for desktop to boot" >&2 |
212 | + local timeout=$(($(date +%s) + 300)) |
213 | + while [ "$(date +%s)" -le $timeout ]; do |
214 | + out=$(adb $ADBOPTS shell 'gdbus call --timeout 5 --session --dest com.canonical.UnityGreeter --object-path / --method org.freedesktop.DBus.Properties.Get com.canonical.UnityGreeter IsActive 2>/dev/null') |
215 | + if [ -n "$out" ]; then |
216 | + timeout=0 |
217 | + break |
218 | + fi |
219 | + sleep 5 |
220 | + done |
221 | + if [ "$timeout" -gt 0 ]; then |
222 | + echo "ERROR: timed out waiting for Unity greeter" >&2 |
223 | + exit 1 |
224 | + fi |
225 | + |
226 | + # disable screen dimming; ugly, but pretty much everything else hangs forever |
227 | + adb $ADBOPTS shell "setsid powerd-cli display </dev/null >/dev/null 2>&1 & disown; |
228 | + while ! pidof powerd-cli >/dev/null; do sleep 0.1; done" |
229 | + |
230 | + # unlock the greeter |
231 | + adb $ADBOPTS shell "gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter && echo Greeter unlocked" >/dev/null |
232 | +} |
233 | + |
234 | +revert() { |
235 | + # revert is only offered on Ubuntu images |
236 | + echo "Performing factory reset, this will take a minute..." >&2 |
237 | + |
238 | + # save current network connections |
239 | + NETCONF=$(phablet-config $ADBOPTS network --read) || true: |
240 | + |
241 | + # do factory reset |
242 | + adb $ADBOPTS shell 'gdbus call --system -d com.canonical.SystemImage -o /Service -m com.canonical.SystemImage.FactoryReset' |
243 | + wait_booted |
244 | + adb $ADBOPTS shell 'while ! pidof NetworkManager >/dev/null; do sleep 1; done' |
245 | + |
246 | + # restore network connections |
247 | + if [ -n "$NETCONF" ]; then |
248 | + phablet-config $ADBOPTS network --write "$NETCONF" |
249 | + fi |
250 | + |
251 | + ubuntu_prepare_config |
252 | + ubuntu_prepare_for_testing |
253 | +} |
254 | + |
255 | +reboot() { |
256 | + if [ -z "$FWD_PORT" ]; then |
257 | + echo "ERROR: Must pass --fwd-port" >&2 |
258 | + exit 1 |
259 | + fi |
260 | + BOOT_TARGET=$(adb pull /run/adt_reboot_target /dev/stdout) || BOOT_TARGET="" |
261 | + adb $ADBOPTS reboot $BOOT_TARGET |
262 | + wait_booted |
263 | + adb $ADBOPTS forward tcp:$FWD_PORT tcp:22 |
264 | + adb $ADBOPTS shell "gdbus call -y -d com.canonical.PropertyService -o /com/canonical/PropertyService -m com.canonical.PropertyService.SetProperty ssh true >/dev/null" |
265 | + ubuntu_prepare_for_testing |
266 | +} |
267 | + |
268 | +cleanup() { |
269 | + adb $ADBOPTS shell pkill powerd-cli |
270 | +} |
271 | + |
272 | + |
273 | +# |
274 | +# main |
275 | +# |
276 | + |
277 | +# argument parsing |
278 | +SHORTOPTS="l:,p:,s:,w,r,b" |
279 | +LONGOPTS="login:,password:,serial:,rw,apt-update,reset,reboot,no-reset,fwd-port:" |
280 | + |
281 | +TEMP=$(getopt -o $SHORTOPTS --long $LONGOPTS -- "$@") |
282 | +eval set -- "$TEMP" |
283 | + |
284 | +while true; do |
285 | + case "$1" in |
286 | + -l|--login) |
287 | + SSH_USER=$2 |
288 | + shift 2;; |
289 | + -p|--password) |
290 | + SUDO_PASSWORD="$2" |
291 | + shift 2;; |
292 | + -s|--serial) |
293 | + ADBOPTS="$ADBOPTS -s $2" |
294 | + shift 2;; |
295 | + -b|--reboot) |
296 | + REBOOT="1" |
297 | + shift;; |
298 | + -r|--reset) |
299 | + echo "--reset is currently broken as it does not restore PIN/developer mode. Use -b/--reboot instead." >&2 |
300 | + exit 1 |
301 | + RESET="1" |
302 | + shift;; |
303 | + # passed in "extraopts" so that --reset is only applied once, not |
304 | + # in between tests that call "revert" |
305 | + --no-reset) |
306 | + RESET="" |
307 | + shift;; |
308 | + --fwd-port) |
309 | + FWD_PORT="$2" |
310 | + shift 2;; |
311 | + --) |
312 | + shift; |
313 | + break;; |
314 | + *) |
315 | + echo "E: $(basename $0): Unsupported option $1" >&2 |
316 | + exit 1;; |
317 | + esac |
318 | +done |
319 | + |
320 | +if [ -z "$1" ]; then |
321 | + echo "Needs to be called with command as first argument" >&2 |
322 | + exit 1 |
323 | +fi |
324 | + |
325 | +cmd=$(echo "$1"|tr [[:upper:]] [[:lower:]]) |
326 | +shift |
327 | + |
328 | +case $cmd in |
329 | + open) |
330 | + open;; |
331 | + revert) |
332 | + revert;; |
333 | + reboot) |
334 | + reboot;; |
335 | + cleanup) |
336 | + cleanup;; |
337 | + *) |
338 | + echo "invalid command $cmd" >&2 |
339 | + exit 1 |
340 | + ;; |
341 | +esac |
342 | |
343 | === modified file 'debian/tests/control' |
344 | --- debian/tests/control 2015-03-12 14:57:16 +0000 |
345 | +++ debian/tests/control 2015-03-12 16:11:21 +0000 |
346 | @@ -3,4 +3,10 @@ |
347 | Depends: python3-autopilot, |
348 | python3-coverage, |
349 | python3-psutil, |
350 | + system-image-dbus |
351 | |
352 | +Test-Command: cd debian/tests; python3 -m unittest ubuntu_ota_tests.tests.test_basic_upgrade |
353 | +Restrictions: needs-root allow-stderr |
354 | +Depends: python3-autopilot, |
355 | + python3-psutil, |
356 | + system-image-cli |
357 | \ No newline at end of file |
358 | |
359 | === modified file 'debian/tests/ubuntu_ota_tests/__init__.py' |
360 | --- debian/tests/ubuntu_ota_tests/__init__.py 2015-03-06 04:26:55 +0000 |
361 | +++ debian/tests/ubuntu_ota_tests/__init__.py 2015-03-12 16:11:21 +0000 |
362 | @@ -17,11 +17,15 @@ |
363 | # |
364 | |
365 | from ubuntu_ota_tests import ( |
366 | + hooks, |
367 | services, |
368 | system, |
369 | + upgrade, |
370 | ) |
371 | |
372 | __all__ = [ |
373 | + 'hooks', |
374 | 'services', |
375 | 'system', |
376 | + 'upgrade', |
377 | ] |
378 | |
379 | === added file 'debian/tests/ubuntu_ota_tests/hooks.py' |
380 | --- debian/tests/ubuntu_ota_tests/hooks.py 1970-01-01 00:00:00 +0000 |
381 | +++ debian/tests/ubuntu_ota_tests/hooks.py 2015-03-12 16:11:21 +0000 |
382 | @@ -0,0 +1,60 @@ |
383 | +# |
384 | +# Ubuntu OTA Tests |
385 | +# Copyright (C) 2015 Canonical |
386 | +# |
387 | +# This program is free software: you can redistribute it and/or modify |
388 | +# it under the terms of the GNU General Public License as published by |
389 | +# the Free Software Foundation, either version 3 of the License, or |
390 | +# (at your option) any later version. |
391 | +# |
392 | +# This program is distributed in the hope that it will be useful, |
393 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
394 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
395 | +# GNU General Public License for more details. |
396 | +# |
397 | +# You should have received a copy of the GNU General Public License |
398 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
399 | +# |
400 | + |
401 | +import logging |
402 | +import subprocess |
403 | + |
404 | +from systemimage import reboot |
405 | + |
406 | + |
407 | +log = logging.getLogger('systemimage') |
408 | + |
409 | + |
410 | +class ADTRebootToRecovery(reboot.BaseReboot): |
411 | + |
412 | + """Hook to be used during system image upgrade to apply the upgrade.""" |
413 | + |
414 | + def reboot(self): |
415 | + """Reboot the testbed to apply the upgrade. |
416 | + |
417 | + This method does not execute the reboot, it tells adt-run that the |
418 | + reboot is needed and adt executes it. |
419 | + |
420 | + """ |
421 | + self._set_adt_reboot_to_recovery_flag() |
422 | + try: |
423 | + # When running tests with adt-run, we can't just execute a reboot |
424 | + # because it will break the communication with the host. This |
425 | + # script tell adt-run that a reboot is required. The reboot is |
426 | + # executed from the host, saving the state so that the test can |
427 | + # continue when the testbed comes back. |
428 | + autopkgtest_reboot_script = '/tmp/autopkgtest-reboot' |
429 | + # The reboot mark will be set to the $ADT_REBOOT_MARK environment |
430 | + # variable after the machine is rebooted. It can be used in tests |
431 | + # to tell when the reboot happened. |
432 | + reboot_mark = 'rebooted' |
433 | + subprocess.check_output([autopkgtest_reboot_script, reboot_mark]) |
434 | + except subprocess.CalledProcessError as error: |
435 | + log.exception('reboot exit status: {}'.format(error.returncode)) |
436 | + log.exception('reboot command output: {}'.format(error.output)) |
437 | + raise |
438 | + |
439 | + def _set_adt_reboot_to_recovery_flag(self): |
440 | + """Set a flag to tell adt that the reboot needs to go into recovery.""" |
441 | + with open('/run/adt_reboot_target', 'w') as reboot_target: |
442 | + reboot_target.write('recovery') |
443 | |
444 | === added directory 'debian/tests/ubuntu_ota_tests/tests' |
445 | === added file 'debian/tests/ubuntu_ota_tests/tests/__init__.py' |
446 | === added file 'debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py' |
447 | --- debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py 1970-01-01 00:00:00 +0000 |
448 | +++ debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py 2015-03-12 16:11:21 +0000 |
449 | @@ -0,0 +1,34 @@ |
450 | +# |
451 | +# Ubuntu OTA Tests |
452 | +# Copyright (C) 2015 Canonical |
453 | +# |
454 | +# This program is free software: you can redistribute it and/or modify |
455 | +# it under the terms of the GNU General Public License as published by |
456 | +# the Free Software Foundation, either version 3 of the License, or |
457 | +# (at your option) any later version. |
458 | +# |
459 | +# This program is distributed in the hope that it will be useful, |
460 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
461 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
462 | +# GNU General Public License for more details. |
463 | +# |
464 | +# You should have received a copy of the GNU General Public License |
465 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
466 | +# |
467 | + |
468 | +import os |
469 | +import unittest |
470 | + |
471 | +from ubuntu_ota_tests import upgrade |
472 | + |
473 | + |
474 | +class OTABasicUpgradeTestCase(unittest.TestCase): |
475 | + |
476 | + def test_basic_over_the_air_upgrade(self): |
477 | + rebooted_mark = os.environ.get('ADT_REBOOT_MARK', None) |
478 | + if not rebooted_mark: |
479 | + # The upgrade with dbus needs more work, it's getting stuck. |
480 | + # upgrade.upgrade_with_system_image_dbus() |
481 | + upgrade.upgrade_with_system_image_cli() |
482 | + else: |
483 | + print('Rebooted') |
484 | |
485 | === added file 'debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py.THIS' |
486 | --- debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py.THIS 1970-01-01 00:00:00 +0000 |
487 | +++ debian/tests/ubuntu_ota_tests/tests/test_basic_upgrade.py.THIS 2015-03-12 16:11:21 +0000 |
488 | @@ -0,0 +1,34 @@ |
489 | +# |
490 | +# Ubuntu OTA Tests |
491 | +# Copyright (C) 2015 Canonical |
492 | +# |
493 | +# This program is free software: you can redistribute it and/or modify |
494 | +# it under the terms of the GNU General Public License as published by |
495 | +# the Free Software Foundation, either version 3 of the License, or |
496 | +# (at your option) any later version. |
497 | +# |
498 | +# This program is distributed in the hope that it will be useful, |
499 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
500 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
501 | +# GNU General Public License for more details. |
502 | +# |
503 | +# You should have received a copy of the GNU General Public License |
504 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
505 | +# |
506 | + |
507 | +import os |
508 | +import unittest |
509 | + |
510 | +from ubuntu_ota_tests import upgrade |
511 | + |
512 | + |
513 | +class OTABasicUpgradeTestCase(unittest.TestCase): |
514 | + |
515 | + def test_basic_over_the_air_upgrade(self): |
516 | + rebooted_mark = os.environ.get('ADT_REBOOT_MARK', None) |
517 | + if not rebooted_mark: |
518 | + # The upgrade with dbus needs more work, it's getting stuck. |
519 | + # upgrade.upgrade_with_system_image_dbus() |
520 | + upgrade.upgrade_with_system_image_cli() |
521 | + else: |
522 | + print('Rebooted') |
523 | |
524 | === added file 'debian/tests/ubuntu_ota_tests/upgrade.py' |
525 | --- debian/tests/ubuntu_ota_tests/upgrade.py 1970-01-01 00:00:00 +0000 |
526 | +++ debian/tests/ubuntu_ota_tests/upgrade.py 2015-03-12 16:11:21 +0000 |
527 | @@ -0,0 +1,28 @@ |
528 | +# |
529 | +# Ubuntu OTA Tests |
530 | +# Copyright (C) 2015 Canonical |
531 | +# |
532 | +# This program is free software: you can redistribute it and/or modify |
533 | +# it under the terms of the GNU General Public License as published by |
534 | +# the Free Software Foundation, either version 3 of the License, or |
535 | +# (at your option) any later version. |
536 | +# |
537 | +# This program is distributed in the hope that it will be useful, |
538 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
539 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
540 | +# GNU General Public License for more details. |
541 | +# |
542 | +# You should have received a copy of the GNU General Public License |
543 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
544 | +# |
545 | + |
546 | +import subprocess |
547 | + |
548 | +from ubuntu_ota_tests import hooks |
549 | + |
550 | + |
551 | +def upgrade_with_system_image_cli(): |
552 | + command = 'system-image-cli -v -g' |
553 | + print('Upgrading with ' + command) |
554 | + subprocess.check_call(command.split()) |
555 | + hooks.ADTRebootToRecovery().reboot() |
I've been playing with this branch for a long time, so I think now it's good to give it a review. I think it achieves the purpose of investigating adb-reboot, and it actually has a test to proof it.
I couldn't get the dbus upgrade to work, and to finish that I need some of the other branches. So for now I removed the dbus code and left a cli upgrade. I will move the dbus code I had to the other reboot or upgrade card.
This works with the currently released version of system-image-cli. It doesn't work with the one from barry's PPA. But we have to use the new version with the dbus upgrade, so it will be done on one of those cards too.