Merge lp:~vila/ubuntu-test-cases/boottest into lp:~canonical-ci-engineering/ubuntu-test-cases/boottest

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: 405
Proposed branch: lp:~vila/ubuntu-test-cases/boottest
Merge into: lp:~canonical-ci-engineering/ubuntu-test-cases/boottest
Diff against target: 157 lines (+71/-6)
4 files modified
jenkins/testconfig.py (+1/-0)
scripts/device_info.py (+50/-5)
scripts/provision.sh (+11/-1)
utils/host/get-device-type (+9/-0)
To merge this branch: bzr merge lp:~vila/ubuntu-test-cases/boottest
Reviewer Review Type Date Requested Status
Para Siva (community) Approve
Review via email: mp+249301@code.launchpad.net

Description of the change

Reconcile the boottest branch by merging lp:~ubuntu-test-case-dev/ubuntu-test-cases/touch to get the krillin recovery handling and krillin-11 -> krillin-15 declarations

To post a comment you must log in.
Revision history for this message
Para Siva (psivaa) wrote :

Thanks for spotting this, the main ubuntu-test-cases/touch does provision the device properly. I assume merging this would not cause any boottest specific issues, if there were any tweaks made for that. But we could deal with it as and when they arise.
Thanks again.
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jenkins/testconfig.py'
2--- jenkins/testconfig.py 2014-11-20 17:28:52 +0000
3+++ jenkins/testconfig.py 2015-02-11 10:52:47 +0000
4@@ -59,6 +59,7 @@
5 APTest('unity8-autopilot', 'unity8'),
6 APTest('camera-app-autopilot'),
7 APTest('dialer-app-autopilot', pkgs=['dialer-app-autopilot']),
8+ APTest('ubuntu-keyboard-autopilot', pkgs=['ubuntu-keyboard-autopilot']),
9 APTest('messaging-app-autopilot', pkgs=['messaging-app-autopilot']),
10 APTest('address-book-app-autopilot', pkgs=['address-book-app-autopilot']),
11 APTest('reminders-autopilot',
12
13=== modified file 'scripts/device_info.py'
14--- scripts/device_info.py 2015-01-27 03:37:14 +0000
15+++ scripts/device_info.py 2015-02-11 10:52:47 +0000
16@@ -1,9 +1,13 @@
17 #!/usr/bin/env python
18
19 import logging
20+import os
21 import re
22+import requests
23 import subprocess
24+import sys
25 import time
26+import urlparse
27
28 from ncd_usb import set_relay
29
30@@ -57,12 +61,27 @@
31
32 def reimage_from_fastboot(self):
33 #Starting from fastboot mode, put a known-good image on the device
34+ recovery_base = 'http://people.canonical.com/~plars/touch'
35+ recovery_img = 'recovery-{}.img'.format(self.devtype)
36+ recovery_url = os.path.join(recovery_base, recovery_img)
37+ # For certain devices, we need to first pull an alternate
38+ # recovery image that has adb enabled. If it's needed, it will
39+ # be at that url, otherwise we don't even try to use it.
40+ if not os.path.exists(os.path.join('recovery', recovery_img)):
41+ try:
42+ _download(recovery_url, 'recovery')
43+ except:
44+ # Don't fail for any reason, if attempt to flash without
45+ pass
46+ udf_command = ['ubuntu-device-flash', 'touch', '--serial',
47+ self.serial, '--channel', 'ubuntu-touch/stable',
48+ '--bootstrap', '--developer-mode',
49+ '--password', '0000']
50+ if os.path.exists(os.path.join('recovery', recovery_img)):
51+ udf_command.extend(['--recovery-image',
52+ os.path.join('recovery', recovery_img)])
53 log.info("Flashing the last stable image")
54- subprocess.check_output(['ubuntu-device-flash', 'touch', '--serial',
55- self.serial, '--channel',
56- 'ubuntu-touch/stable', '--bootstrap',
57- '--developer-mode',
58- '--password', '0000'])
59+ subprocess.check_output(udf_command)
60 return self.wait_for_device(600)
61
62 def wait_for_fastboot(self, timeout=120):
63@@ -108,6 +127,9 @@
64 def force_bootloader(self):
65 bootloader_func = getattr(
66 self, '_{}_to_bootloader'.format(self.devtype))
67+ if not self.relay_url:
68+ log.error("Device cannot be recovered, no relay data exists!")
69+ sys.exit(-1)
70 if bootloader_func and callable(bootloader_func):
71 bootloader_func()
72 else:
73@@ -185,6 +207,11 @@
74 relay_url="http://decatur.ubuntu-ci",
75 bank=2, power_pin=0, volume_up_pin=1,
76 volume_down_pin=2),
77+ "krillin-11": TouchDevice("krillin", "JB072312"),
78+ "krillin-12": TouchDevice("krillin", "JB071487"),
79+ "krillin-13": TouchDevice("krillin", "JB044235"),
80+ "krillin-14": TouchDevice("krillin", "JB072205"),
81+ "krillin-15": TouchDevice("krillin", "JB071743"),
82 "ps-mako-01": TouchDevice("mako", "0090f741e3d141bc"),
83 "ps-mako-02": TouchDevice("mako", "04ccca120acd4dea"),
84 "ps-mako-03": TouchDevice("mako", "04cb53b598546534"),
85@@ -256,3 +283,21 @@
86 def get_device(name):
87 # This raises KeyError if we don't have any record of that device
88 return DEVICES[name]
89+
90+
91+def _download(url, path):
92+ os.makedirs(path)
93+ urlpath = urlparse.urlsplit(url).path
94+ filename = os.path.basename(urlpath)
95+ filename = os.path.join(path, filename)
96+
97+ response = requests.get(url, stream=True)
98+ response.raise_for_status()
99+ with open(filename, 'wb') as f:
100+ for chunk in response.iter_content(chunk_size=64 * 1024):
101+ # Ignore keep-alives
102+ if not chunk:
103+ continue
104+ f.write(chunk)
105+ f.flush()
106+ return filename
107
108=== modified file 'scripts/provision.sh'
109--- scripts/provision.sh 2014-11-17 15:52:10 +0000
110+++ scripts/provision.sh 2015-02-11 10:52:47 +0000
111@@ -8,6 +8,7 @@
112 export PATH=${BASEDIR}/../utils/host:${PATH}
113
114 RESDIR=`pwd`/clientlogs
115+RECOVERY_URL="http://people.canonical.com/~plars/touch"
116
117 NETWORK_FILE="${NETWORK_FILE-${HOME}/.ubuntu-ci/wifi.conf}"
118
119@@ -118,6 +119,7 @@
120
121 full_flash() {
122 log "FLASHING DEVICE"
123+ DEVICE_TYPE=$(get-device-type)
124 # Use a 60 second retry loop for reboot_bootloader.
125 # If the attempt failed, it may take nearly 60 seconds to complete
126 # the reboot cycle to get the device back to a sane state.
127@@ -125,7 +127,15 @@
128 # Use a 10 second retry loop for ubuntu-device-flash.
129 # Most failures appear to be transient and work with an immediate
130 # retry.
131- retry 10 3 timeout 1800 ubuntu-device-flash ${REVISION} touch --password $PHABLET_PASSWORD $IMAGE_OPT
132+ RECOVERY=""
133+ mkdir -p recovery
134+ log "The following wget is only needed for some devices. If it fails, it's probably safe to ignore"
135+ wget -P recovery \
136+ ${RECOVERY_URL}/recovery-${DEVICE_TYPE}.img || /bin/true
137+ if [ -f recovery/recovery-${DEVICE_TYPE}.img ]; then
138+ RECOVERY="--recovery-image=recovery/recovery-${DEVICE_TYPE}.img"
139+ fi
140+ retry 10 3 timeout 1800 ubuntu-device-flash ${REVISION} touch ${RECOVERY} --password $PHABLET_PASSWORD $IMAGE_OPT
141 adb wait-for-device
142 sleep 60 #give the system a little time
143 }
144
145=== added file 'utils/host/get-device-type'
146--- utils/host/get-device-type 1970-01-01 00:00:00 +0000
147+++ utils/host/get-device-type 2015-02-11 10:52:47 +0000
148@@ -0,0 +1,9 @@
149+#!/usr/bin/env python
150+
151+import os
152+from phabletutils.environment import detect_device
153+
154+device_type = os.environ.get('DEVICE_TYPE')
155+if device_type is None:
156+ device_type = detect_device(None)
157+print(device_type)

Subscribers

People subscribed via source and target branches