Merge lp:~thomir-deactivatedaccount/ubuntu-test-cases/touch-convert-boottest-to-spaces into lp:ubuntu-test-cases/touch
- touch-convert-boottest-to-spaces
- Merge into touch
Proposed by
Thomi Richards
Status: | Merged |
---|---|
Approved by: | Thomi Richards |
Approved revision: | 407 |
Merged at revision: | 406 |
Proposed branch: | lp:~thomir-deactivatedaccount/ubuntu-test-cases/touch-convert-boottest-to-spaces |
Merge into: | lp:ubuntu-test-cases/touch |
Diff against target: |
1311 lines (+514/-514) 7 files modified
scripts/assert-image (+14/-14) scripts/boottest.sh (+21/-21) scripts/jenkins.sh (+136/-136) scripts/provision.sh (+152/-152) scripts/run-autopilot-tests.sh (+180/-180) scripts/run-mp.sh (+8/-8) scripts/run-touch-upgrade.sh (+3/-3) |
To merge this branch: | bzr merge lp:~thomir-deactivatedaccount/ubuntu-test-cases/touch-convert-boottest-to-spaces |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomi Richards (community) | Approve | ||
Francis Ginther | Approve | ||
Review via email: mp+261031@code.launchpad.net |
This proposal supersedes a proposal from 2015-06-03.
Commit message
Convert tabs to spaces in scripts/*
Description of the change
Convert tabs to spaces in scripts/*
To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
Revision history for this message
Francis Ginther (fginther) wrote : | # |
Just two nitpicks to adjust some comment lines. Otherwise, approve.
review:
Approve
- 407. By Thomi Richards
-
realign comments.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'scripts/assert-image' |
2 | --- scripts/assert-image 2015-04-14 23:18:52 +0000 |
3 | +++ scripts/assert-image 2015-06-03 20:47:10 +0000 |
4 | @@ -12,20 +12,20 @@ |
5 | REQUIRED_UUID=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-uuid) |
6 | ACTUAL_UUID=$(adb shell "cat /home/phablet/.ci-uuid | tr -d '\r\n'") |
7 | if [ "$REQUIRED_UUID" != "$ACTUAL_UUID" ] ; then |
8 | - echo "= UUIDs $REQUIRED_UUID != $ACTUAL_UUID" |
9 | - SERVER=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-server | tr -d '\r\n') |
10 | - ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args | tr -d '\r\n') |
11 | - CUST=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations | tr -d '\r\n') |
12 | - echo "reprovisioning device with: $ARGS" |
13 | - echo "customizing device with: $CUST" |
14 | - #Make the image writable if we reprovision by adding a space |
15 | - #after to CUSTOMIZE so it is never empty |
16 | - UUID=$REQUIRED_UUID IMAGE_SERVER=$SERVER IMAGE_OPT=$ARGS \ |
17 | - CUSTOMIZE="$CUST " ${BASEDIR}/scripts/provision.sh |
18 | + echo "= UUIDs $REQUIRED_UUID != $ACTUAL_UUID" |
19 | + SERVER=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-server | tr -d '\r\n') |
20 | + ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args | tr -d '\r\n') |
21 | + CUST=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations | tr -d '\r\n') |
22 | + echo "reprovisioning device with: $ARGS" |
23 | + echo "customizing device with: $CUST" |
24 | + #Make the image writable if we reprovision by adding a space |
25 | + #after to CUSTOMIZE so it is never empty |
26 | + UUID=$REQUIRED_UUID IMAGE_SERVER=$SERVER IMAGE_OPT=$ARGS \ |
27 | + CUSTOMIZE="$CUST " ${BASEDIR}/scripts/provision.sh |
28 | else |
29 | - echo "= UUIDS match, reusing image on target" |
30 | - echo $REQUIRED_UUID > clientlogs/.ci-uuid |
31 | - curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args > clientlogs/.ci-flash-args |
32 | - curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations > clientlogs/.ci-customizations |
33 | + echo "= UUIDS match, reusing image on target" |
34 | + echo $REQUIRED_UUID > clientlogs/.ci-uuid |
35 | + curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args > clientlogs/.ci-flash-args |
36 | + curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations > clientlogs/.ci-customizations |
37 | fi |
38 | |
39 | |
40 | === modified file 'scripts/boottest.sh' |
41 | --- scripts/boottest.sh 2015-06-03 14:41:46 +0000 |
42 | +++ scripts/boottest.sh 2015-06-03 20:47:10 +0000 |
43 | @@ -18,7 +18,7 @@ |
44 | # ../config/boottest.rc.example). |
45 | BOOTTESTRC=${HOME}/.ubuntu-ci/boottest.rc |
46 | if [ -f $BOOTTESTRC ]; then |
47 | - source $BOOTTESTRC |
48 | + source $BOOTTESTRC |
49 | fi |
50 | |
51 | # Default adt-run timeout |
52 | @@ -38,11 +38,11 @@ |
53 | # Look for a known bug, lp1421009, that results in unity8 not starting |
54 | # and prevents adt-run from accepting the testbed |
55 | check_for_lp1421009() { |
56 | - SYMPTOM="ERROR: timed out waiting for Unity greeter" |
57 | - LINK="http://launchpad.net/bugs/1421009" |
58 | - if [ $1 -eq 16 ] && grep -q "${SYMPTOM}" ${2}/log; then |
59 | - END_MESSAGE="Test failed due to ${LINK}" |
60 | - fi |
61 | + SYMPTOM="ERROR: timed out waiting for Unity greeter" |
62 | + LINK="http://launchpad.net/bugs/1421009" |
63 | + if [ $1 -eq 16 ] && grep -q "${SYMPTOM}" ${2}/log; then |
64 | + END_MESSAGE="Test failed due to ${LINK}" |
65 | + fi |
66 | } |
67 | |
68 | # Create an exit handler so that we are sure to create a error file even |
69 | @@ -163,22 +163,22 @@ |
70 | |
71 | |
72 | if [ -n "${FORCE_FAILURE}" ]; then |
73 | - # Force a boottest failure by running an alternate DEP8 test |
74 | - set +e |
75 | - ${ADT_CMD} --unbuilt-tree ${TESTS}/bootfail -o results ${ADT_OPTS} |
76 | - RET=$? |
77 | - set -e |
78 | + # Force a boottest failure by running an alternate DEP8 test |
79 | + set +e |
80 | + ${ADT_CMD} --unbuilt-tree ${TESTS}/bootfail -o results ${ADT_OPTS} |
81 | + RET=$? |
82 | + set -e |
83 | else |
84 | - # Now execute the boot test |
85 | - set +e |
86 | - ${BASEDIR}/scripts/run-adt.py ${ADT_CMD} --unbuilt-tree ${TESTS}/boottest -o results ${ADT_OPTS} |
87 | - RET=$? |
88 | - # Fetch the sourcepkg-version file that contains the version data |
89 | - # for the package under test. We can't use the testpkg-version file |
90 | - # that adt-run generates because it provides the version of the |
91 | - # fake boottest package, not the package we're actually testing. |
92 | - adb pull /home/phablet/sourcepkg-version results/sourcepkg-version |
93 | - set -e |
94 | + # Now execute the boot test |
95 | + set +e |
96 | + ${BASEDIR}/scripts/run-adt.py ${ADT_CMD} --unbuilt-tree ${TESTS}/boottest -o results ${ADT_OPTS} |
97 | + RET=$? |
98 | + # Fetch the sourcepkg-version file that contains the version data |
99 | + # for the package under test. We can't use the testpkg-version file |
100 | + # that adt-run generates because it provides the version of the |
101 | + # fake boottest package, not the package we're actually testing. |
102 | + adb pull /home/phablet/sourcepkg-version results/sourcepkg-version |
103 | + set -e |
104 | fi |
105 | |
106 | check_for_lp1421009 $RET results |
107 | |
108 | === modified file 'scripts/jenkins.sh' |
109 | --- scripts/jenkins.sh 2015-04-15 16:58:19 +0000 |
110 | +++ scripts/jenkins.sh 2015-06-03 20:47:10 +0000 |
111 | @@ -12,13 +12,13 @@ |
112 | |
113 | |
114 | usage() { |
115 | - cat <<EOF |
116 | + cat <<EOF |
117 | usage: $0 -a APP [-s ANDROID_SERIAL] [-p FILE -p FILE ...] [-Q] |
118 | |
119 | Provisions the given device with the latest build |
120 | |
121 | OPTIONS: |
122 | - -h Show this message |
123 | + -h Show this message |
124 | -s Specify the serial of the device to install |
125 | -a The application under the "tests" directory to test |
126 | -p Extra file to pull from target (absolute path or relative to /home/phablet) |
127 | @@ -30,134 +30,134 @@ |
128 | PIDS="" |
129 | |
130 | cleanup() { |
131 | - set +e |
132 | - echo "killing child pids: $PIDS" |
133 | - for p in $PIDS ; do |
134 | - kill $p |
135 | - done |
136 | + set +e |
137 | + echo "killing child pids: $PIDS" |
138 | + for p in $PIDS ; do |
139 | + kill $p |
140 | + done |
141 | } |
142 | |
143 | test_from_host() { |
144 | - export PATH=${BASEDIR}/utils/host:${PATH} |
145 | - |
146 | - # allow for certain commands to run from host/target |
147 | - # see unity8-autopilot/ts_control for example |
148 | - export TARGET_PREFIX=adb-shell |
149 | - |
150 | - [ -z $ANDROID_SERIAL ] || ADBOPTS="-s $ANDROID_SERIAL" |
151 | - |
152 | - # If we are not in the utah group, then we don't have permissions |
153 | - # for /var/lib/utah, so run under sudo |
154 | - if ! groups |grep -q utah ; then |
155 | - SUDO="sudo" |
156 | - sudo TARGET_PREFIX="${TARGET_PREFIX}" PATH="${PATH}" \ |
157 | - ${UTAH_PHABLET_CMD} \ |
158 | - ${ADBOPTS} \ |
159 | - --from-host \ |
160 | - --whoopsie \ |
161 | - --results-dir "${RESDIR}" \ |
162 | - --skip-install --skip-network --skip-utah \ |
163 | - --pull /var/crash \ |
164 | - --pull /home/phablet/.cache/upstart \ |
165 | - --pull /tmp/xmlresults \ |
166 | - --pull /var/log/syslog \ |
167 | - --pull /var/log/kern.log \ |
168 | - --pull /var/log/upstart/whoopsie.log \ |
169 | - $EXTRA_PULL \ |
170 | - -l "${TESTSUITE_HOST}/master.run" |
171 | - else |
172 | - TARGET_PREFIX="${TARGET_PREFIX}" PATH="${PATH}" \ |
173 | - ${UTAH_PHABLET_CMD} \ |
174 | - ${ADBOPTS} \ |
175 | - --from-host \ |
176 | - --whoopsie \ |
177 | - --results-dir "${RESDIR}" \ |
178 | - --skip-install --skip-network --skip-utah \ |
179 | - --pull /var/crash \ |
180 | - --pull /home/phablet/.cache/upstart \ |
181 | - --pull /tmp/xmlresults \ |
182 | - --pull /var/log/syslog \ |
183 | - --pull /var/log/kern.log \ |
184 | - --pull /var/log/upstart/whoopsie.log \ |
185 | - $EXTRA_PULL \ |
186 | - -l "${TESTSUITE_HOST}/master.run" |
187 | - fi |
188 | - |
189 | - # make sure the user running this script can remove its artifacts. |
190 | - # only run this if we had to run under sudo |
191 | - if [ "${SUDO}" = "sudo" ] ; then |
192 | - sudo chown -R "${USER}" ${RESDIR} |
193 | - fi |
194 | + export PATH=${BASEDIR}/utils/host:${PATH} |
195 | + |
196 | + # allow for certain commands to run from host/target |
197 | + # see unity8-autopilot/ts_control for example |
198 | + export TARGET_PREFIX=adb-shell |
199 | + |
200 | + [ -z $ANDROID_SERIAL ] || ADBOPTS="-s $ANDROID_SERIAL" |
201 | + |
202 | + # If we are not in the utah group, then we don't have permissions |
203 | + # for /var/lib/utah, so run under sudo |
204 | + if ! groups |grep -q utah ; then |
205 | + SUDO="sudo" |
206 | + sudo TARGET_PREFIX="${TARGET_PREFIX}" PATH="${PATH}" \ |
207 | + ${UTAH_PHABLET_CMD} \ |
208 | + ${ADBOPTS} \ |
209 | + --from-host \ |
210 | + --whoopsie \ |
211 | + --results-dir "${RESDIR}" \ |
212 | + --skip-install --skip-network --skip-utah \ |
213 | + --pull /var/crash \ |
214 | + --pull /home/phablet/.cache/upstart \ |
215 | + --pull /tmp/xmlresults \ |
216 | + --pull /var/log/syslog \ |
217 | + --pull /var/log/kern.log \ |
218 | + --pull /var/log/upstart/whoopsie.log \ |
219 | + $EXTRA_PULL \ |
220 | + -l "${TESTSUITE_HOST}/master.run" |
221 | + else |
222 | + TARGET_PREFIX="${TARGET_PREFIX}" PATH="${PATH}" \ |
223 | + ${UTAH_PHABLET_CMD} \ |
224 | + ${ADBOPTS} \ |
225 | + --from-host \ |
226 | + --whoopsie \ |
227 | + --results-dir "${RESDIR}" \ |
228 | + --skip-install --skip-network --skip-utah \ |
229 | + --pull /var/crash \ |
230 | + --pull /home/phablet/.cache/upstart \ |
231 | + --pull /tmp/xmlresults \ |
232 | + --pull /var/log/syslog \ |
233 | + --pull /var/log/kern.log \ |
234 | + --pull /var/log/upstart/whoopsie.log \ |
235 | + $EXTRA_PULL \ |
236 | + -l "${TESTSUITE_HOST}/master.run" |
237 | + fi |
238 | + |
239 | + # make sure the user running this script can remove its artifacts. |
240 | + # only run this if we had to run under sudo |
241 | + if [ "${SUDO}" = "sudo" ] ; then |
242 | + sudo chown -R "${USER}" ${RESDIR} |
243 | + fi |
244 | } |
245 | |
246 | assert_image() { |
247 | - [ -z $INSTALL_URL ] && return |
248 | - echo "Ensuring target has proper image..." |
249 | - REQUIRED_UUID=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-uuid) |
250 | - ACTUAL_UUID=$(adb shell "cat /home/phablet/.ci-uuid | tr -d '\r\n'") |
251 | - if [ "$REQUIRED_UUID" != "$ACTUAL_UUID" ] ; then |
252 | - echo "UUIDs $REQUIRED_UUID != $ACTUAL_UUID, reprovisioning device..." |
253 | - ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-utah-args | tr -d '\r\n') |
254 | - SERVER=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-server | tr -d '\r\n') |
255 | - UUID=$REQUIRED_UUID IMAGE_SERVER=$SERVER IMAGE_OPT=$ARGS \ |
256 | - ${BASEDIR}/scripts/provision.sh |
257 | - else |
258 | - echo "UUIDS match" |
259 | - fi |
260 | + [ -z $INSTALL_URL ] && return |
261 | + echo "Ensuring target has proper image..." |
262 | + REQUIRED_UUID=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-uuid) |
263 | + ACTUAL_UUID=$(adb shell "cat /home/phablet/.ci-uuid | tr -d '\r\n'") |
264 | + if [ "$REQUIRED_UUID" != "$ACTUAL_UUID" ] ; then |
265 | + echo "UUIDs $REQUIRED_UUID != $ACTUAL_UUID, reprovisioning device..." |
266 | + ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-utah-args | tr -d '\r\n') |
267 | + SERVER=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-server | tr -d '\r\n') |
268 | + UUID=$REQUIRED_UUID IMAGE_SERVER=$SERVER IMAGE_OPT=$ARGS \ |
269 | + ${BASEDIR}/scripts/provision.sh |
270 | + else |
271 | + echo "UUIDS match" |
272 | + fi |
273 | } |
274 | |
275 | main() { |
276 | - rm -rf $RESDIR |
277 | - mkdir $RESDIR |
278 | - |
279 | - assert_image |
280 | - |
281 | - # print the build date so the jenkins job can use it as the |
282 | - # build description |
283 | - adb pull /var/log/installer/media-info ${RESDIR} |
284 | - BUILDID=$(adb shell cat /home/phablet/.ci-version) |
285 | - echo "= TOUCH IMAGE VERSION:$BUILDID" |
286 | - |
287 | - adb shell "top -n1 -b" > ${RESDIR}/top.log |
288 | - |
289 | - set -x |
290 | - adb shell 'sudo rm -f /var/crash/*' |
291 | - if [ -z $QUICK ] ; then |
292 | - # get the phone in sane place |
293 | - adb reboot |
294 | - # sometimes reboot doesn't happen fast enough, so add a little |
295 | - # delay to help ensure its actually rebooted and we didn't just |
296 | - # connect back to the device before it rebooted |
297 | - adb wait-for-device |
298 | - sleep 5 |
299 | - adb wait-for-device |
300 | - phablet-network --skip-setup -t 90s |
301 | - adb shell sudo powerd-cli active & |
302 | - PIDS="$PIDS $!" |
303 | - adb shell sudo powerd-cli display on & |
304 | - PIDS="$PIDS $!" |
305 | - else |
306 | - echo "SKIPPING phone reboot..." |
307 | - fi |
308 | - |
309 | - ${BASEDIR}/utils/host/adb-shell "sudo aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules" |
310 | - |
311 | - echo "launching test from the host...." |
312 | - test_from_host |
313 | - adb shell 'sudo rm -f /var/crash/*' |
314 | - |
315 | - if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then |
316 | - echo "errors found" |
317 | - EXITCODE=1 |
318 | - fi |
319 | - if ! `grep "^failures: [!0]" < $UTAHFILE >/dev/null` ; then |
320 | - echo "failures found" |
321 | - EXITCODE=2 |
322 | - fi |
323 | - echo "Results Summary" |
324 | - echo "---------------" |
325 | - egrep '^(errors|failures|passes|fetch_errors):' $UTAHFILE |
326 | - exit $EXITCODE |
327 | + rm -rf $RESDIR |
328 | + mkdir $RESDIR |
329 | + |
330 | + assert_image |
331 | + |
332 | + # print the build date so the jenkins job can use it as the |
333 | + # build description |
334 | + adb pull /var/log/installer/media-info ${RESDIR} |
335 | + BUILDID=$(adb shell cat /home/phablet/.ci-version) |
336 | + echo "= TOUCH IMAGE VERSION:$BUILDID" |
337 | + |
338 | + adb shell "top -n1 -b" > ${RESDIR}/top.log |
339 | + |
340 | + set -x |
341 | + adb shell 'sudo rm -f /var/crash/*' |
342 | + if [ -z $QUICK ] ; then |
343 | + # get the phone in sane place |
344 | + adb reboot |
345 | + # sometimes reboot doesn't happen fast enough, so add a little |
346 | + # delay to help ensure its actually rebooted and we didn't just |
347 | + # connect back to the device before it rebooted |
348 | + adb wait-for-device |
349 | + sleep 5 |
350 | + adb wait-for-device |
351 | + phablet-network --skip-setup -t 90s |
352 | + adb shell sudo powerd-cli active & |
353 | + PIDS="$PIDS $!" |
354 | + adb shell sudo powerd-cli display on & |
355 | + PIDS="$PIDS $!" |
356 | + else |
357 | + echo "SKIPPING phone reboot..." |
358 | + fi |
359 | + |
360 | + ${BASEDIR}/utils/host/adb-shell "sudo aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules" |
361 | + |
362 | + echo "launching test from the host...." |
363 | + test_from_host |
364 | + adb shell 'sudo rm -f /var/crash/*' |
365 | + |
366 | + if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then |
367 | + echo "errors found" |
368 | + EXITCODE=1 |
369 | + fi |
370 | + if ! `grep "^failures: [!0]" < $UTAHFILE >/dev/null` ; then |
371 | + echo "failures found" |
372 | + EXITCODE=2 |
373 | + fi |
374 | + echo "Results Summary" |
375 | + echo "---------------" |
376 | + egrep '^(errors|failures|passes|fetch_errors):' $UTAHFILE |
377 | + exit $EXITCODE |
378 | } |
379 | |
380 | while getopts p:s:a:Qh opt; do |
381 | @@ -172,20 +172,20 @@ |
382 | a) |
383 | APP=$OPTARG |
384 | ;; |
385 | - p) |
386 | - EXTRA_PULL_FILE=$OPTARG |
387 | - |
388 | - if [ ! -z $EXTRA_PULL_FILE ]; then |
389 | - # relative paths are assumed to be relative to /home/phablet |
390 | - E_P_START=`echo $EXTRA_PULL_FILE | cut -c1` |
391 | - |
392 | - if [ $E_P_START = '/' ]; then |
393 | - EXTRA_PULL="$EXTRA_PULL --pull $EXTRA_PULL_FILE" |
394 | - else |
395 | - EXTRA_PULL="$EXTRA_PULL --pull /home/phablet/$EXTRA_PULL_FILE" |
396 | - fi |
397 | - fi |
398 | - ;; |
399 | + p) |
400 | + EXTRA_PULL_FILE=$OPTARG |
401 | + |
402 | + if [ ! -z $EXTRA_PULL_FILE ]; then |
403 | + # relative paths are assumed to be relative to /home/phablet |
404 | + E_P_START=`echo $EXTRA_PULL_FILE | cut -c1` |
405 | + |
406 | + if [ $E_P_START = '/' ]; then |
407 | + EXTRA_PULL="$EXTRA_PULL --pull $EXTRA_PULL_FILE" |
408 | + else |
409 | + EXTRA_PULL="$EXTRA_PULL --pull /home/phablet/$EXTRA_PULL_FILE" |
410 | + fi |
411 | + fi |
412 | + ;; |
413 | Q) |
414 | QUICK=1 |
415 | ;; |
416 | @@ -197,7 +197,7 @@ |
417 | lines=$(adb devices | wc -l) |
418 | if [ $lines -gt 3 ] ; then |
419 | echo "ERROR: More than one device attached, please use -s option" |
420 | - echo |
421 | + echo |
422 | usage |
423 | exit 1 |
424 | fi |
425 | |
426 | === modified file 'scripts/provision.sh' |
427 | --- scripts/provision.sh 2015-06-01 17:26:16 +0000 |
428 | +++ scripts/provision.sh 2015-06-03 20:47:10 +0000 |
429 | @@ -23,7 +23,7 @@ |
430 | Provisions the given device with the latest build |
431 | |
432 | OPTIONS: |
433 | - -h Show this message |
434 | + -h Show this message |
435 | -s Specify the serial of the device to install |
436 | -n Select network file |
437 | -P add the ppa to the target (can be repeated) |
438 | @@ -36,94 +36,94 @@ |
439 | } |
440 | |
441 | image_info() { |
442 | - # mark the version we installed in /home/phablet/.ci-[uuid,flash-args] |
443 | - # adb shell messes up \n's with \r\n's so do the whole of the regex on the target |
444 | - IMAGEVER=$(adb shell "sudo system-image-cli -i | sed -n -e 's/version version: \([0-9]*\)/\1/p' -e 's/version ubuntu: \([0-9]*\)/\1/p' -e 's/version device: \([0-9]*\)/\1/p' | paste -s -d:") |
445 | - CHAN=$(adb shell "sudo system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:") |
446 | - REV=$(echo $IMAGEVER | cut -d: -f1) |
447 | - echo "$IMAGE_OPT" | grep -q "\-\-revision" || REVISION="--revision=${REV}" |
448 | - echo "$IMAGE_OPT" | grep -q "\-\-channel" || IMAGE_OPT="${IMAGE_OPT} --channel $CHAN" |
449 | - adb shell "echo '${IMAGEVER}' > /home/phablet/.ci-version" |
450 | - echo $UUID > $RESDIR/.ci-uuid |
451 | - adb push $RESDIR/.ci-uuid /home/phablet/ |
452 | - cat > $RESDIR/.ci-flash-args <<EOF |
453 | + # mark the version we installed in /home/phablet/.ci-[uuid,flash-args] |
454 | + # adb shell messes up \n's with \r\n's so do the whole of the regex on the target |
455 | + IMAGEVER=$(adb shell "sudo system-image-cli -i | sed -n -e 's/version version: \([0-9]*\)/\1/p' -e 's/version ubuntu: \([0-9]*\)/\1/p' -e 's/version device: \([0-9]*\)/\1/p' | paste -s -d:") |
456 | + CHAN=$(adb shell "sudo system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:") |
457 | + REV=$(echo $IMAGEVER | cut -d: -f1) |
458 | + echo "$IMAGE_OPT" | grep -q "\-\-revision" || REVISION="--revision=${REV}" |
459 | + echo "$IMAGE_OPT" | grep -q "\-\-channel" || IMAGE_OPT="${IMAGE_OPT} --channel $CHAN" |
460 | + adb shell "echo '${IMAGEVER}' > /home/phablet/.ci-version" |
461 | + echo $UUID > $RESDIR/.ci-uuid |
462 | + adb push $RESDIR/.ci-uuid /home/phablet/ |
463 | + cat > $RESDIR/.ci-flash-args <<EOF |
464 | $IMAGE_OPT |
465 | EOF |
466 | - adb push $RESDIR/.ci-flash-args /home/phablet/.ci-flash-args |
467 | - cat > $RESDIR/.ci-flash-server <<EOF |
468 | + adb push $RESDIR/.ci-flash-args /home/phablet/.ci-flash-args |
469 | + cat > $RESDIR/.ci-flash-server <<EOF |
470 | $IMAGE_SERVER |
471 | EOF |
472 | - adb push $RESDIR/.ci-flash-args /home/phablet/.ci-flash-server |
473 | - echo $CUSTOMIZE > $RESDIR/.ci-customizations |
474 | - adb push $RESDIR/.ci-customizations /home/phablet/.ci-customizations |
475 | + adb push $RESDIR/.ci-flash-args /home/phablet/.ci-flash-server |
476 | + echo $CUSTOMIZE > $RESDIR/.ci-customizations |
477 | + adb push $RESDIR/.ci-customizations /home/phablet/.ci-customizations |
478 | } |
479 | |
480 | log() { |
481 | - echo = $(date): $* |
482 | + echo = $(date): $* |
483 | } |
484 | |
485 | set_hwclock() { |
486 | - log "SETTING HWCLOCK TO CURRENT TIME" |
487 | + log "SETTING HWCLOCK TO CURRENT TIME" |
488 | # Use ip for ntp.ubuntu.com in case resolving doesn't work yet |
489 | - adb-shell sudo ntpdate 91.189.94.4 || log "WARNING: could not set ntpdate" |
490 | - # hwclock sync has to happen after we set writable image |
491 | - adb-shell sudo hwclock -w || log "WARNING: could not sync hwclock" |
492 | - log "Current date on device is:" |
493 | - adb shell date |
494 | - log "Current hwclock on device is:" |
495 | - adb shell sudo hwclock |
496 | + adb-shell sudo ntpdate 91.189.94.4 || log "WARNING: could not set ntpdate" |
497 | + # hwclock sync has to happen after we set writable image |
498 | + adb-shell sudo hwclock -w || log "WARNING: could not sync hwclock" |
499 | + log "Current date on device is:" |
500 | + adb shell date |
501 | + log "Current hwclock on device is:" |
502 | + adb shell sudo hwclock |
503 | } |
504 | |
505 | retry() { |
506 | - timeout=$1 |
507 | - shift |
508 | - loops=$1 |
509 | - shift |
510 | - cmd=$* |
511 | - loopcnt=0 |
512 | - while true; do |
513 | - $cmd && break || { |
514 | - if [ $loopcnt -lt $loops ] ; then |
515 | - loopcnt=$[$loopcnt+1] |
516 | - echo "Retry [$loopcnt/$loops] after $timeout seconds..." |
517 | - sleep $timeout |
518 | - else |
519 | - echo Failed on \'$cmd\' after $loops retries |
520 | - exit 1 |
521 | - fi |
522 | - } |
523 | - done |
524 | + timeout=$1 |
525 | + shift |
526 | + loops=$1 |
527 | + shift |
528 | + cmd=$* |
529 | + loopcnt=0 |
530 | + while true; do |
531 | + $cmd && break || { |
532 | + if [ $loopcnt -lt $loops ] ; then |
533 | + loopcnt=$[$loopcnt+1] |
534 | + echo "Retry [$loopcnt/$loops] after $timeout seconds..." |
535 | + sleep $timeout |
536 | + else |
537 | + echo Failed on \'$cmd\' after $loops retries |
538 | + exit 1 |
539 | + fi |
540 | + } |
541 | + done |
542 | } |
543 | |
544 | reboot_bootloader() { |
545 | - # In CI, we've seen cases where 'adb reboot bootloader' will just |
546 | - # reboot the device and not enter the bootloader. Adding another |
547 | - # reboot and retrying was found to be a successful workaround: |
548 | - # https://bugs.launchpad.net/ubuntu/+source/android-tools/+bug/1359488 |
549 | - # |
550 | - # We only want to do this if we know ANDROID_SERIAL. Attempting |
551 | - # to guess might end up flashing the wrong device. |
552 | + # In CI, we've seen cases where 'adb reboot bootloader' will just |
553 | + # reboot the device and not enter the bootloader. Adding another |
554 | + # reboot and retrying was found to be a successful workaround: |
555 | + # https://bugs.launchpad.net/ubuntu/+source/android-tools/+bug/1359488 |
556 | + # |
557 | + # We only want to do this if we know ANDROID_SERIAL. Attempting |
558 | + # to guess might end up flashing the wrong device. |
559 | |
560 | - log "Attempting adb reboot bootloader" |
561 | - adb reboot bootloader |
562 | - if [ -n "${ANDROID_SERIAL}" ] ; then |
563 | - # Entering the bootloader should take < 10 seconds, add some |
564 | - # padding for device variance. |
565 | - sleep 30 |
566 | - if ! fastboot devices | grep -q "${ANDROID_SERIAL}"; then |
567 | - log "Device not in fastboot after adb reboot bootloader" |
568 | - # After a failed 'reboot bootloader' attempt, a reboot |
569 | - # is used to get the device back to a saner state. |
570 | - adb reboot |
571 | - return 1 |
572 | - fi |
573 | - fi |
574 | - return 0 |
575 | + log "Attempting adb reboot bootloader" |
576 | + adb reboot bootloader |
577 | + if [ -n "${ANDROID_SERIAL}" ] ; then |
578 | + # Entering the bootloader should take < 10 seconds, add some |
579 | + # padding for device variance. |
580 | + sleep 30 |
581 | + if ! fastboot devices | grep -q "${ANDROID_SERIAL}"; then |
582 | + log "Device not in fastboot after adb reboot bootloader" |
583 | + # After a failed 'reboot bootloader' attempt, a reboot |
584 | + # is used to get the device back to a saner state. |
585 | + adb reboot |
586 | + return 1 |
587 | + fi |
588 | + fi |
589 | + return 0 |
590 | } |
591 | |
592 | download_recovery () { |
593 | - # FIXME: ev mentioned on irc that we should add some cheksum for |
594 | - # those images -- vila 2015-02-20 |
595 | + # FIXME: ev mentioned on irc that we should add some cheksum for |
596 | + # those images -- vila 2015-02-20 |
597 | wget -P recovery ${RECOVERY_URL}/recovery-${DEVICE_TYPE}.img |
598 | if [ -f recovery/recovery-${DEVICE_TYPE}.img ]; then |
599 | RECOVERY="--recovery-image=recovery/recovery-${DEVICE_TYPE}.img" |
600 | @@ -133,80 +133,80 @@ |
601 | } |
602 | |
603 | full_flash() { |
604 | - log "FLASHING DEVICE" |
605 | - DEVICE_TYPE=$(get-device-type) |
606 | - # Use a 60 second retry loop for reboot_bootloader. |
607 | - # If the attempt failed, it may take nearly 60 seconds to complete |
608 | - # the reboot cycle to get the device back to a sane state. |
609 | - retry 60 3 reboot_bootloader |
610 | - RECOVERY="" |
611 | - # We need to distinguish between devices with no recovery images and |
612 | - # failures to download existing recovery images. Only krillin |
613 | + log "FLASHING DEVICE" |
614 | + DEVICE_TYPE=$(get-device-type) |
615 | + # Use a 60 second retry loop for reboot_bootloader. |
616 | + # If the attempt failed, it may take nearly 60 seconds to complete |
617 | + # the reboot cycle to get the device back to a sane state. |
618 | + retry 60 3 reboot_bootloader |
619 | + RECOVERY="" |
620 | + # We need to distinguish between devices with no recovery images and |
621 | + # failures to download existing recovery images. Only krillin |
622 | # and arale have a recovery image for now. |
623 | - if [ "${DEVICE_TYPE}" == 'krillin' ] || |
624 | - [ "${DEVICE_TYPE}" == 'arale' ]; then |
625 | - mkdir -p recovery |
626 | - retry 10 3 download_recovery |
627 | - fi |
628 | - # Use a 10 second retry loop for ubuntu-device-flash. |
629 | - # Most failures appear to be transient and work with an immediate |
630 | - # retry. |
631 | - retry 10 3 timeout 1800 ubuntu-device-flash ${IMAGE_SERVER} ${REVISION} touch ${RECOVERY} --password $PHABLET_PASSWORD $IMAGE_OPT |
632 | - # If the flashed image fails to install and reboots, wait-for-device |
633 | - # will timeout |
634 | - timeout 600 adb wait-for-device |
635 | - sleep 60 #give the system a little time |
636 | + if [ "${DEVICE_TYPE}" == 'krillin' ] || |
637 | + [ "${DEVICE_TYPE}" == 'arale' ]; then |
638 | + mkdir -p recovery |
639 | + retry 10 3 download_recovery |
640 | + fi |
641 | + # Use a 10 second retry loop for ubuntu-device-flash. |
642 | + # Most failures appear to be transient and work with an immediate |
643 | + # retry. |
644 | + retry 10 3 timeout 1800 ubuntu-device-flash ${IMAGE_SERVER} ${REVISION} touch ${RECOVERY} --password $PHABLET_PASSWORD $IMAGE_OPT |
645 | + # If the flashed image fails to install and reboots, wait-for-device |
646 | + # will timeout |
647 | + timeout 600 adb wait-for-device |
648 | + sleep 60 #give the system a little time |
649 | } |
650 | |
651 | while getopts i:s:n:P:D:p:r:wh opt; do |
652 | - case $opt in |
653 | - h) |
654 | - usage |
655 | - exit 0 |
656 | - ;; |
657 | - n) |
658 | - NETWORK_FILE=$OPTARG |
659 | - ;; |
660 | - s) |
661 | - export ANDROID_SERIAL=$OPTARG |
662 | - ;; |
663 | - i) |
664 | - IMAGE_TYPE=$OPTARG |
665 | - ;; |
666 | - w) |
667 | - # making this a non-zero length string enables the logic |
668 | - CUSTOMIZE=" " |
669 | - ;; |
670 | - P) |
671 | - CUSTOMIZE="$CUSTOMIZE --ppa $OPTARG" |
672 | - ;; |
673 | - D) |
674 | - CUSTOMIZE="$CUSTOMIZE --package-dir $OPTARG" |
675 | - ;; |
676 | - p) |
677 | - CUSTOMIZE="$CUSTOMIZE -p $OPTARG" |
678 | - ;; |
679 | - r) |
680 | + case $opt in |
681 | + h) |
682 | + usage |
683 | + exit 0 |
684 | + ;; |
685 | + n) |
686 | + NETWORK_FILE=$OPTARG |
687 | + ;; |
688 | + s) |
689 | + export ANDROID_SERIAL=$OPTARG |
690 | + ;; |
691 | + i) |
692 | + IMAGE_TYPE=$OPTARG |
693 | + ;; |
694 | + w) |
695 | + # making this a non-zero length string enables the logic |
696 | + CUSTOMIZE=" " |
697 | + ;; |
698 | + P) |
699 | + CUSTOMIZE="$CUSTOMIZE --ppa $OPTARG" |
700 | + ;; |
701 | + D) |
702 | + CUSTOMIZE="$CUSTOMIZE --package-dir $OPTARG" |
703 | + ;; |
704 | + p) |
705 | + CUSTOMIZE="$CUSTOMIZE -p $OPTARG" |
706 | + ;; |
707 | + r) |
708 | REVISION="--revision=$OPTARG" |
709 | - ;; |
710 | + ;; |
711 | |
712 | - esac |
713 | + esac |
714 | done |
715 | |
716 | if [ -z $ANDROID_SERIAL ] ; then |
717 | - # ensure we only have one device attached |
718 | - lines=$(adb devices | wc -l) |
719 | - if [ $lines -gt 3 ] ; then |
720 | - echo "ERROR: More than one device attached, please use -s option" |
721 | - echo |
722 | - usage |
723 | - exit 1 |
724 | - fi |
725 | + # ensure we only have one device attached |
726 | + lines=$(adb devices | wc -l) |
727 | + if [ $lines -gt 3 ] ; then |
728 | + echo "ERROR: More than one device attached, please use -s option" |
729 | + echo |
730 | + usage |
731 | + exit 1 |
732 | + fi |
733 | fi |
734 | |
735 | if [ ! -f $NETWORK_FILE ] && [ -z $USE_EMULATOR ] ; then |
736 | - echo "ERROR: NETWORK_FILE, $NETWORK_FILE, not found" |
737 | - exit 1 |
738 | + echo "ERROR: NETWORK_FILE, $NETWORK_FILE, not found" |
739 | + exit 1 |
740 | fi |
741 | |
742 | set -x |
743 | @@ -214,25 +214,25 @@ |
744 | mkdir -p $RESDIR |
745 | |
746 | if [ -z $USE_EMULATOR ] ; then |
747 | - full_flash |
748 | + full_flash |
749 | else |
750 | - log "CREATING EMULATOR" |
751 | - ubuntu-emulator destroy --yes $ANDROID_SERIAL || true |
752 | - sudo ubuntu-emulator create $ANDROID_SERIAL $IMAGE_OPT |
753 | - ${BASEDIR}/reboot-and-wait |
754 | + log "CREATING EMULATOR" |
755 | + ubuntu-emulator destroy --yes $ANDROID_SERIAL || true |
756 | + sudo ubuntu-emulator create $ANDROID_SERIAL $IMAGE_OPT |
757 | + ${BASEDIR}/reboot-and-wait |
758 | fi |
759 | |
760 | if [ -z $USE_EMULATOR ] ; then |
761 | - log "SETTING UP WIFI" |
762 | - retry 60 5 adb-shell 'sudo -iu phablet env |grep UPSTART_SESSION=unix' |
763 | - retry 60 5 phablet-network -n $NETWORK_FILE |
764 | + log "SETTING UP WIFI" |
765 | + retry 60 5 adb-shell 'sudo -iu phablet env |grep UPSTART_SESSION=unix' |
766 | + retry 60 5 phablet-network -n $NETWORK_FILE |
767 | fi |
768 | |
769 | phablet-config welcome-wizard --disable |
770 | |
771 | if [ -n "$CUSTOMIZE" ] ; then |
772 | - log "CUSTOMIZING IMAGE" |
773 | - phablet-config writable-image -r ${PHABLET_PASSWORD} $CUSTOMIZE |
774 | + log "CUSTOMIZING IMAGE" |
775 | + phablet-config writable-image -r ${PHABLET_PASSWORD} $CUSTOMIZE |
776 | fi |
777 | |
778 | log "SETTING UP SUDO" |
779 | @@ -243,20 +243,20 @@ |
780 | adb shell "sudo dbus-send --system --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User32011 org.freedesktop.DBus.Properties.Set string:com.canonical.unity.AccountsService string:demo-edges variant:boolean:false" |
781 | |
782 | if [ -n "${SKIP_CLICK}" ]; then |
783 | - log "SKIPPING CLICK PACKAGE SETUP AS REQUESTED" |
784 | + log "SKIPPING CLICK PACKAGE SETUP AS REQUESTED" |
785 | else |
786 | - log "SETTING UP CLICK PACKAGES" |
787 | - CLICK_TEST_OPTS="" |
788 | - channel_name=$(adb shell "sudo system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:") |
789 | - # Before running phablet-click-test setup, we need to make sure the |
790 | - # session is available |
791 | - retry 60 5 adb-shell 'sudo -iu phablet env |grep UPSTART_SESSION=unix' |
792 | + log "SETTING UP CLICK PACKAGES" |
793 | + CLICK_TEST_OPTS="" |
794 | + channel_name=$(adb shell "sudo system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:") |
795 | + # Before running phablet-click-test setup, we need to make sure the |
796 | + # session is available |
797 | + retry 60 5 adb-shell 'sudo -iu phablet env |grep UPSTART_SESSION=unix' |
798 | |
799 | - # FIXME: workaround for phablet-click-test-setup to pull the right sources |
800 | - if [[ $channel_name == *rtm* ]] ; then |
801 | - CLICK_TEST_OPTS="--distribution ubuntu-rtm --series 14.09" |
802 | - fi |
803 | - phablet-click-test-setup $CLICK_TEST_OPTS |
804 | + # FIXME: workaround for phablet-click-test-setup to pull the right sources |
805 | + if [[ $channel_name == *rtm* ]] ; then |
806 | + CLICK_TEST_OPTS="--distribution ubuntu-rtm --series 14.09" |
807 | + fi |
808 | + phablet-click-test-setup $CLICK_TEST_OPTS |
809 | fi |
810 | |
811 | # get our target-based utilities into our PATH |
812 | |
813 | === modified file 'scripts/run-autopilot-tests.sh' |
814 | --- scripts/run-autopilot-tests.sh 2015-04-15 17:27:08 +0000 |
815 | +++ scripts/run-autopilot-tests.sh 2015-06-03 20:47:10 +0000 |
816 | @@ -10,13 +10,13 @@ |
817 | |
818 | |
819 | usage() { |
820 | - cat <<EOF |
821 | + cat <<EOF |
822 | usage: $0 -a APP [-s ANDROID_SERIAL] [-Q] [-o results_dir] [-S] |
823 | |
824 | Runs a set of autopilot tests on the target |
825 | |
826 | OPTIONS: |
827 | - -h Show this message |
828 | + -h Show this message |
829 | -s Specify the serial of the device to test |
830 | -a The application to test (can be repeated) |
831 | -o Specify the directory to place results in. |
832 | @@ -28,240 +28,240 @@ |
833 | } |
834 | |
835 | log_error() { |
836 | - echo ERROR: $* >> ${RESDIR}/runner-errors.txt |
837 | + echo ERROR: $* >> ${RESDIR}/runner-errors.txt |
838 | } |
839 | |
840 | setup_test() { |
841 | - app=$1 |
842 | - label=$2 |
843 | - odir=$3 |
844 | - { |
845 | - pkgs=$(${BASEDIR}/jenkins/testconfig.py packages -a $app) |
846 | - if [ "$label" = "setup" ] ; then |
847 | - if [ -z "${SKIP_TESTCONFIG}" ]; then |
848 | - adb-shell sudo apt-get install -yq --force-yes $pkgs |
849 | - fi |
850 | - else |
851 | - if [ -z "${SKIP_TESTCONFIG}" ]; then |
852 | - #Always remove dbus-x11 because it causes |
853 | - #problems when we leave it around |
854 | - pkgs="$pkgs dbus-x11" |
855 | - adb-shell sudo apt-get autoremove --purge -y $pkgs || /bin/true |
856 | - fi |
857 | - fi |
858 | - echo $? > ${odir}/setup_${label}.rc |
859 | - } 2>&1 | tee ${odir}/setup_${label}.log |
860 | + app=$1 |
861 | + label=$2 |
862 | + odir=$3 |
863 | + { |
864 | + pkgs=$(${BASEDIR}/jenkins/testconfig.py packages -a $app) |
865 | + if [ "$label" = "setup" ] ; then |
866 | + if [ -z "${SKIP_TESTCONFIG}" ]; then |
867 | + adb-shell sudo apt-get install -yq --force-yes $pkgs |
868 | + fi |
869 | + else |
870 | + if [ -z "${SKIP_TESTCONFIG}" ]; then |
871 | + #Always remove dbus-x11 because it causes |
872 | + #problems when we leave it around |
873 | + pkgs="$pkgs dbus-x11" |
874 | + adb-shell sudo apt-get autoremove --purge -y $pkgs || /bin/true |
875 | + fi |
876 | + fi |
877 | + echo $? > ${odir}/setup_${label}.rc |
878 | + } 2>&1 | tee ${odir}/setup_${label}.log |
879 | } |
880 | |
881 | system_settle() { |
882 | - [ -z $NOSETTLE ] || return 0 |
883 | - |
884 | - label=$1 |
885 | - odir=$2 |
886 | - rc=0 |
887 | - timeout=120s |
888 | - if [ "$label" = "before" ] ; then |
889 | - timeout=300s |
890 | - fi |
891 | - |
892 | - settle=${BASEDIR}/tests/systemsettle/systemsettle.sh |
893 | - { |
894 | - export UTAH_PROBE_DIR=${odir} # needed for log file location |
895 | - timeout $timeout $settle -c5 -d6 -p 95 -l $label || rc=1 |
896 | - echo $rc > ${odir}/settle_${label}.rc |
897 | - } 2>&1 | tee ${odir}/settle_${label}.log |
898 | + [ -z $NOSETTLE ] || return 0 |
899 | + |
900 | + label=$1 |
901 | + odir=$2 |
902 | + rc=0 |
903 | + timeout=120s |
904 | + if [ "$label" = "before" ] ; then |
905 | + timeout=300s |
906 | + fi |
907 | + |
908 | + settle=${BASEDIR}/tests/systemsettle/systemsettle.sh |
909 | + { |
910 | + export UTAH_PROBE_DIR=${odir} # needed for log file location |
911 | + timeout $timeout $settle -c5 -d6 -p 95 -l $label || rc=1 |
912 | + echo $rc > ${odir}/settle_${label}.rc |
913 | + } 2>&1 | tee ${odir}/settle_${label}.log |
914 | } |
915 | |
916 | test_app() { |
917 | - app=$1 |
918 | - |
919 | - odir=${RESDIR}/${app} |
920 | - [ -d $odir ] && rm -rf $odir |
921 | - mkdir -p $odir || return 1 |
922 | - |
923 | - system_settle before $odir |
924 | - phablet-config autopilot --dbus-probe enable || \ |
925 | - (log_error "'autopilot dbus-probe enable' failed"; return 1) |
926 | - adb-shell /home/phablet/bin/check-clickhook-rules || \ |
927 | - (log_error "some click profiles missing autopilot rules") |
928 | - |
929 | - setup_test $app setup $odir |
930 | - |
931 | - NOSHELL="" |
932 | - [ "$app" = "unity8" ] && NOSHELL="-n" |
933 | - EXTRA="" |
934 | + app=$1 |
935 | + |
936 | + odir=${RESDIR}/${app} |
937 | + [ -d $odir ] && rm -rf $odir |
938 | + mkdir -p $odir || return 1 |
939 | + |
940 | + system_settle before $odir |
941 | + phablet-config autopilot --dbus-probe enable || \ |
942 | + (log_error "'autopilot dbus-probe enable' failed"; return 1) |
943 | + adb-shell /home/phablet/bin/check-clickhook-rules || \ |
944 | + (log_error "some click profiles missing autopilot rules") |
945 | + |
946 | + setup_test $app setup $odir |
947 | + |
948 | + NOSHELL="" |
949 | + [ "$app" = "unity8" ] && NOSHELL="-n" |
950 | + EXTRA="" |
951 | # Use --timeout-profile=long only if we are using the emulator |
952 | - [ -z $USE_EMULATOR ] || EXTRA="-A '--timeout-profile=long'" |
953 | - |
954 | - phablet-test-run \ |
955 | - $NOSHELL $EXTRA \ |
956 | - -o ${odir} -f subunit \ |
957 | - -a /var/crash -a /home/phablet/.cache/upstart \ |
958 | - -a /var/log/syslog \ |
959 | - -A --timeout-profile=long \ |
960 | - -v $app || true |
961 | - adb shell rm -rf /tmp/ci-logs |
962 | - adb shell mkdir /tmp/ci-logs |
963 | - adb shell sudo install -o phablet \ |
964 | - -m 666 /var/log/upstart/whoopsie.log /tmp/ci-logs |
965 | - adb-shell "sudo system-image-cli --info > /tmp/ci-logs/system-image-cli.log" |
966 | - adb-shell "dpkg -l > /tmp/ci-logs/dpkg-l.log" |
967 | - adb pull /tmp/ci-logs ${odir} |
968 | - |
969 | - system_settle after $odir |
970 | - setup_test $app teardown $odir |
971 | - if [ -f ${odir}/test_results.subunit ] ; then |
972 | - cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml |
973 | - fi |
974 | - ${BASEDIR}/scripts/combine_results ${odir} |
975 | + [ -z $USE_EMULATOR ] || EXTRA="-A '--timeout-profile=long'" |
976 | + |
977 | + phablet-test-run \ |
978 | + $NOSHELL $EXTRA \ |
979 | + -o ${odir} -f subunit \ |
980 | + -a /var/crash -a /home/phablet/.cache/upstart \ |
981 | + -a /var/log/syslog \ |
982 | + -A --timeout-profile=long \ |
983 | + -v $app || true |
984 | + adb shell rm -rf /tmp/ci-logs |
985 | + adb shell mkdir /tmp/ci-logs |
986 | + adb shell sudo install -o phablet \ |
987 | + -m 666 /var/log/upstart/whoopsie.log /tmp/ci-logs |
988 | + adb-shell "sudo system-image-cli --info > /tmp/ci-logs/system-image-cli.log" |
989 | + adb-shell "dpkg -l > /tmp/ci-logs/dpkg-l.log" |
990 | + adb pull /tmp/ci-logs ${odir} |
991 | + |
992 | + system_settle after $odir |
993 | + setup_test $app teardown $odir |
994 | + if [ -f ${odir}/test_results.subunit ] ; then |
995 | + cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml |
996 | + fi |
997 | + ${BASEDIR}/scripts/combine_results ${odir} |
998 | } |
999 | |
1000 | reboot_wait() { |
1001 | - if [ -z $QUICK ] ; then |
1002 | - if ! reboot-and-unlock.sh; then |
1003 | + if [ -z $QUICK ] ; then |
1004 | + if ! reboot-and-unlock.sh; then |
1005 | log_error "Failed to unlock screen, retrying..." |
1006 | reboot-and-unlock.sh || log_error "Screen unlock still fails, continuing anyway" |
1007 | fi |
1008 | - FILES="/var/crash/* /home/phablet/.cache/upstart/*.log*" |
1009 | - if ! adb shell "sudo rm -rf $FILES" ; then |
1010 | - log_error "unable to remove crash and log files, retrying" |
1011 | - adb wait-for-device |
1012 | - adb shell "sudo rm -rf $FILES" |
1013 | - fi |
1014 | - else |
1015 | - echo "SKIPPING phone reboot..." |
1016 | - fi |
1017 | + FILES="/var/crash/* /home/phablet/.cache/upstart/*.log*" |
1018 | + if ! adb shell "sudo rm -rf $FILES" ; then |
1019 | + log_error "unable to remove crash and log files, retrying" |
1020 | + adb wait-for-device |
1021 | + adb shell "sudo rm -rf $FILES" |
1022 | + fi |
1023 | + else |
1024 | + echo "SKIPPING phone reboot..." |
1025 | + fi |
1026 | } |
1027 | |
1028 | if [ -z $USE_EMULATOR ] ; then |
1029 | grab_powerd() { |
1030 | - echo "grabbing powerd cli locks..." |
1031 | - adb shell sudo powerd-cli active & |
1032 | - PIDS="$!" |
1033 | - adb shell sudo powerd-cli display on & |
1034 | - PIDS="$PIDS $!" |
1035 | + echo "grabbing powerd cli locks..." |
1036 | + adb shell sudo powerd-cli active & |
1037 | + PIDS="$!" |
1038 | + adb shell sudo powerd-cli display on & |
1039 | + PIDS="$PIDS $!" |
1040 | } |
1041 | |
1042 | release_powerd() { |
1043 | - if [ -n "$PIDS" ] ; then |
1044 | - echo "killing child pids: $PIDS" |
1045 | - for p in $PIDS ; do |
1046 | - kill $p || true |
1047 | - done |
1048 | - PIDS="" |
1049 | - fi |
1050 | + if [ -n "$PIDS" ] ; then |
1051 | + echo "killing child pids: $PIDS" |
1052 | + for p in $PIDS ; do |
1053 | + kill $p || true |
1054 | + done |
1055 | + PIDS="" |
1056 | + fi |
1057 | adb shell sudo pkill powerd-cli |
1058 | } |
1059 | |
1060 | else |
1061 | grab_powerd() { |
1062 | - #emulator does not use powerd, so this is noop |
1063 | - return 0 |
1064 | + #emulator does not use powerd, so this is noop |
1065 | + return 0 |
1066 | } |
1067 | |
1068 | release_powerd() { |
1069 | - #emulator does not use powerd, so this is noop |
1070 | - return 0 |
1071 | + #emulator does not use powerd, so this is noop |
1072 | + return 0 |
1073 | } |
1074 | fi |
1075 | |
1076 | dashboard_update() { |
1077 | - # only try and update the dashboard if we are configured to |
1078 | - [ -z $DASHBOARD_KEY ] && return 0 |
1079 | - [ -z $DASHBOARD_BUILD ] && return 0 |
1080 | - [ -z $DASHBOARD_IMAGE ] && return 0 |
1081 | - ${BASEDIR}/scripts/dashboard.py $* \ |
1082 | - --image $DASHBOARD_IMAGE \ |
1083 | - --build $DASHBOARD_BUILD || true |
1084 | + # only try and update the dashboard if we are configured to |
1085 | + [ -z $DASHBOARD_KEY ] && return 0 |
1086 | + [ -z $DASHBOARD_BUILD ] && return 0 |
1087 | + [ -z $DASHBOARD_IMAGE ] && return 0 |
1088 | + ${BASEDIR}/scripts/dashboard.py $* \ |
1089 | + --image $DASHBOARD_IMAGE \ |
1090 | + --build $DASHBOARD_BUILD || true |
1091 | } |
1092 | |
1093 | dashboard_result_running() { |
1094 | - dashboard_update result-running --test $1 |
1095 | + dashboard_update result-running --test $1 |
1096 | } |
1097 | |
1098 | dashboard_result_syncing() { |
1099 | - xunit=${RESDIR}/${app}/test_results.xml |
1100 | - [ -f $xunit ] || return 0 |
1101 | + xunit=${RESDIR}/${app}/test_results.xml |
1102 | + [ -f $xunit ] || return 0 |
1103 | |
1104 | - # save a utah.yaml version of the results so the dashboard can process |
1105 | - cat $xunit | ${BASEDIR}/scripts/junit2utah.py > ${RESDIR}/${app}/utah.yaml |
1106 | - dashboard_update result-syncing --test $1 --results ${RESDIR}/${app}/utah.yaml |
1107 | + # save a utah.yaml version of the results so the dashboard can process |
1108 | + cat $xunit | ${BASEDIR}/scripts/junit2utah.py > ${RESDIR}/${app}/utah.yaml |
1109 | + dashboard_update result-syncing --test $1 --results ${RESDIR}/${app}/utah.yaml |
1110 | } |
1111 | |
1112 | main() { |
1113 | - [ -d $RESDIR ] || mkdir -p $RESDIR |
1114 | - |
1115 | - set -x |
1116 | - |
1117 | - for app in $APPS ; do |
1118 | - set +x |
1119 | - echo "========================================================" |
1120 | - echo "= testing $app" |
1121 | - echo "========================================================" |
1122 | - set -x |
1123 | - dashboard_result_running $app |
1124 | - reboot_wait |
1125 | - |
1126 | - grab_powerd |
1127 | - |
1128 | - if ! test_app $app ; then |
1129 | - log_error "testing $app, retrying" |
1130 | - # we sometimes see sporatic adb failures that seem to |
1131 | - # related to MTP. This adds a retry for the test. |
1132 | - # test_app only fails on a device error (not a test |
1133 | - # case error) |
1134 | - adb wait-for-device |
1135 | - test_app $app |
1136 | - fi |
1137 | - dashboard_result_syncing $app |
1138 | - |
1139 | - release_powerd |
1140 | - done |
1141 | + [ -d $RESDIR ] || mkdir -p $RESDIR |
1142 | + |
1143 | + set -x |
1144 | + |
1145 | + for app in $APPS ; do |
1146 | + set +x |
1147 | + echo "========================================================" |
1148 | + echo "= testing $app" |
1149 | + echo "========================================================" |
1150 | + set -x |
1151 | + dashboard_result_running $app |
1152 | + reboot_wait |
1153 | + |
1154 | + grab_powerd |
1155 | + |
1156 | + if ! test_app $app ; then |
1157 | + log_error "testing $app, retrying" |
1158 | + # we sometimes see sporatic adb failures that seem to |
1159 | + # related to MTP. This adds a retry for the test. |
1160 | + # test_app only fails on a device error (not a test |
1161 | + # case error) |
1162 | + adb wait-for-device |
1163 | + test_app $app |
1164 | + fi |
1165 | + dashboard_result_syncing $app |
1166 | + |
1167 | + release_powerd |
1168 | + done |
1169 | } |
1170 | |
1171 | while getopts s:a:o:QSh opt; do |
1172 | - case $opt in |
1173 | - h) |
1174 | - usage |
1175 | - exit 0 |
1176 | - ;; |
1177 | - s) |
1178 | - export ANDROID_SERIAL=$OPTARG |
1179 | - ;; |
1180 | - o) |
1181 | - RESDIR=$OPTARG |
1182 | - ;; |
1183 | - a) |
1184 | - APPS="$APPS $OPTARG" |
1185 | - ;; |
1186 | - Q) |
1187 | - QUICK=1 |
1188 | - ;; |
1189 | - S) |
1190 | - NOSETTLE=1 |
1191 | - ;; |
1192 | - esac |
1193 | + case $opt in |
1194 | + h) |
1195 | + usage |
1196 | + exit 0 |
1197 | + ;; |
1198 | + s) |
1199 | + export ANDROID_SERIAL=$OPTARG |
1200 | + ;; |
1201 | + o) |
1202 | + RESDIR=$OPTARG |
1203 | + ;; |
1204 | + a) |
1205 | + APPS="$APPS $OPTARG" |
1206 | + ;; |
1207 | + Q) |
1208 | + QUICK=1 |
1209 | + ;; |
1210 | + S) |
1211 | + NOSETTLE=1 |
1212 | + ;; |
1213 | + esac |
1214 | done |
1215 | |
1216 | if [ -z $ANDROID_SERIAL ] ; then |
1217 | - # ensure we only have one device attached |
1218 | - lines=$(adb devices | wc -l) |
1219 | - if [ $lines -gt 3 ] ; then |
1220 | - echo "ERROR: More than one device attached, please use -s option" |
1221 | - echo |
1222 | - usage |
1223 | - exit 1 |
1224 | - fi |
1225 | + # ensure we only have one device attached |
1226 | + lines=$(adb devices | wc -l) |
1227 | + if [ $lines -gt 3 ] ; then |
1228 | + echo "ERROR: More than one device attached, please use -s option" |
1229 | + echo |
1230 | + usage |
1231 | + exit 1 |
1232 | + fi |
1233 | fi |
1234 | if [ -z "$APPS" ] ; then |
1235 | - echo "ERROR: No app specified" |
1236 | - usage |
1237 | - exit 1 |
1238 | + echo "ERROR: No app specified" |
1239 | + usage |
1240 | + exit 1 |
1241 | fi |
1242 | |
1243 | trap release_powerd TERM INT EXIT |
1244 | if [ -n "$USE_EMULATOR" ] ; then |
1245 | - echo "disabling system-settle testing for emulator" |
1246 | - NOSETTLE=1 |
1247 | + echo "disabling system-settle testing for emulator" |
1248 | + NOSETTLE=1 |
1249 | fi |
1250 | main |
1251 | |
1252 | === modified file 'scripts/run-mp.sh' |
1253 | --- scripts/run-mp.sh 2014-11-11 18:32:07 +0000 |
1254 | +++ scripts/run-mp.sh 2015-06-03 20:47:10 +0000 |
1255 | @@ -3,10 +3,10 @@ |
1256 | |
1257 | # These are all set via jenkins when running in that context |
1258 | if [ -z "${ANDROID_SERIAL}" ] || [ -z "${package_archive}" ] || \ |
1259 | - [ -z "${test_packages}" ] || [ -z "${test_suite}" ]; then |
1260 | - echo "Missing an env variable: " |
1261 | - echo " ANDROID_SERIAL, package_archive, test_packages or test_suite" |
1262 | - exit 1 |
1263 | + [ -z "${test_packages}" ] || [ -z "${test_suite}" ]; then |
1264 | + echo "Missing an env variable: " |
1265 | + echo " ANDROID_SERIAL, package_archive, test_packages or test_suite" |
1266 | + exit 1 |
1267 | fi |
1268 | |
1269 | BASEDIR=$(dirname $(readlink -f $0))/.. |
1270 | @@ -22,13 +22,13 @@ |
1271 | # configuration files when executed by jenkins. |
1272 | package_list="" |
1273 | for package in ${test_packages}; do |
1274 | - package_list="-p ${package} ${package_list}" |
1275 | + package_list="-p ${package} ${package_list}" |
1276 | done |
1277 | |
1278 | # This is a list of test suites to execute. It's normally just one. |
1279 | suite_list="" |
1280 | for suite in ${test_suite}; do |
1281 | - suite_list="-a ${suite} ${suite_list}" |
1282 | + suite_list="-a ${suite} ${suite_list}" |
1283 | done |
1284 | |
1285 | # The provision.sh and run-smoke scripts can install extra packages to meet |
1286 | @@ -39,6 +39,6 @@ |
1287 | |
1288 | # Provision the device and run the test suite. |
1289 | ${BASEDIR}/scripts/provision.sh -s ${ANDROID_SERIAL} \ |
1290 | - -n ${HOME}/.ubuntu-ci/wifi.conf \ |
1291 | - -D ${package_dir} ${package_list} |
1292 | + -n ${HOME}/.ubuntu-ci/wifi.conf \ |
1293 | + -D ${package_dir} ${package_list} |
1294 | ${BASEDIR}/scripts/run-smoke -s ${ANDROID_SERIAL} -n ${suite_list} |
1295 | |
1296 | === modified file 'scripts/run-touch-upgrade.sh' |
1297 | --- scripts/run-touch-upgrade.sh 2013-08-30 20:28:05 +0000 |
1298 | +++ scripts/run-touch-upgrade.sh 2015-06-03 20:47:10 +0000 |
1299 | @@ -26,9 +26,9 @@ |
1300 | |
1301 | set +e |
1302 | sudo NETWORK_FILE=$NETWORK_FILE \ |
1303 | - $UTAH_PHABLET_CMD -s $ANDROID_SERIAL \ |
1304 | - --from-host --skip-install --skip-utah --skip-network -l $RUNLIST \ |
1305 | - --results-dir=$RESDIR |
1306 | + $UTAH_PHABLET_CMD -s $ANDROID_SERIAL \ |
1307 | + --from-host --skip-install --skip-utah --skip-network -l $RUNLIST \ |
1308 | + --results-dir=$RESDIR |
1309 | EXITCODE=$? |
1310 | |
1311 | UTAHFILE=$RESDIR/utah.yaml |
Convert tabs to spaces in scripts/*