Merge lp:~psivaa/ubuntu-test-cases/mako-recoveries into lp:ubuntu-test-cases/touch

Proposed by Para Siva
Status: Merged
Approved by: Para Siva
Approved revision: 415
Merged at revision: 411
Proposed branch: lp:~psivaa/ubuntu-test-cases/mako-recoveries
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 83 lines (+29/-12)
2 files modified
scripts/provision.sh (+17/-12)
scripts/recover.py (+12/-0)
To merge this branch: bzr merge lp:~psivaa/ubuntu-test-cases/mako-recoveries
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Paul Larson Needs Fixing
Review via email: mp+270653@code.launchpad.net

Commit message

To make sure that we recover the device fully in cases of 'detect_device' failures.

Description of the change

This is to fix a couple of issues:
1. In instances like [1], where 'adb shell' works but for some reason, phablet_utils.detect_device is failing. The fix is to perform a full-recovery, in such a case too. [2] indicates that the full flashing being carried out in cases where 'INFO:root:Device detected as mako' is not present in the logs. Compare this to [2] where 'INFO:root:Device detected as mako' being present after 'job-runner/scripts/recover.py mako-08' call and the full recovery is not attempted.

2. To make sure that 'adb reboot bootloader' actually boots the device into 'fastboot' before attempting to flash the device.

[1]: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-mako-08/1626/console
[2]: http://s-jenkins.ubuntu-ci:8080/job/psivaa-touch-flash-mako-08/1/console
[3]: http://s-jenkins.ubuntu-ci:8080/job/psivaa-touch-flash-mako-08/2/console

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

One very minor inline comment. Otherwise, from a code standpoint it looks fine to me.

Revision history for this message
Paul Larson (pwlars) wrote :

A few comments below. I'll leave it up to you whether you want to fix them, but I think it's worth considering.

review: Needs Fixing
Revision history for this message
Para Siva (psivaa) wrote :

Thanks Paul for the comments. I've replied to them. We could discuss this in the IRC as well.

414. By Para Siva

Fix commenting comment

Revision history for this message
Paul Larson (pwlars) :
Revision history for this message
Francis Ginther (fginther) wrote :

I understand plars concerns with these changes, but we need to make some changes to stop this devices from getting in a usable, but unflashable state and poisoning results. I'm comfortable with this approach as a first attempt to address the problem and accept that we may need to revert or revisit it.

Just one inline comment that I think should be addressed.

review: Needs Fixing
415. By Para Siva

Review comment fixes to only infinitely retry as opposed to retry 3 times

Revision history for this message
Para Siva (psivaa) wrote :

Thanks for the comments. rev 415 contains the fix for Francis's comments.

Revision history for this message
Francis Ginther (fginther) wrote :

I've tested this in a s-jenkins provision operation and boottest. Should be good to land.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/provision.sh'
2--- scripts/provision.sh 2015-06-03 21:40:26 +0000
3+++ scripts/provision.sh 2015-09-11 08:25:28 +0000
4@@ -109,14 +109,22 @@
5 if [ -n "${ANDROID_SERIAL}" ] ; then
6 # Entering the bootloader should take < 10 seconds, add some
7 # padding for device variance.
8- sleep 30
9- if ! fastboot devices | grep -q "${ANDROID_SERIAL}"; then
10- log "Device not in fastboot after adb reboot bootloader"
11- # After a failed 'reboot bootloader' attempt, a reboot
12- # is used to get the device back to a saner state.
13- adb reboot
14- return 1
15- fi
16+ while true; do
17+ sleep 30
18+ if ! fastboot devices | grep -q "${ANDROID_SERIAL}"; then
19+ log "Device not in fastboot after `adb reboot bootloader`"
20+ # XXX psivaa: 20150910: No point in continuing
21+ # if `adb reboot bootloader` fails,
22+ # which appears to cause issues during testing.
23+ # This fix is to improve from
24+ # `adb reboot && return 1` to carry out infinite
25+ # `adb reboot bootloader`
26+ adb reboot bootloader
27+ else
28+ log "=========== Device in fastboot =========="
29+ break
30+ fi
31+ done
32 fi
33 return 0
34 }
35@@ -135,10 +143,7 @@
36 full_flash() {
37 log "FLASHING DEVICE"
38 DEVICE_TYPE=$(get-device-type)
39- # Use a 60 second retry loop for reboot_bootloader.
40- # If the attempt failed, it may take nearly 60 seconds to complete
41- # the reboot cycle to get the device back to a sane state.
42- retry 60 3 reboot_bootloader
43+ reboot_bootloader
44 RECOVERY=""
45 # We need to distinguish between devices with no recovery images and
46 # failures to download existing recovery images. Only krillin
47
48=== modified file 'scripts/recover.py'
49--- scripts/recover.py 2015-06-01 17:07:47 +0000
50+++ scripts/recover.py 2015-09-11 08:25:28 +0000
51@@ -8,6 +8,8 @@
52 import time
53 import yaml
54
55+from phabletutils.environment import detect_device
56+
57 log = logging.getLogger()
58 logging.basicConfig(level=logging.INFO)
59
60@@ -77,6 +79,12 @@
61 log.error("Fatal error marking {} offline".format(node))
62
63
64+def get_device_type():
65+ device_type = os.environ.get('DEVICE_TYPE')
66+ if device_type is None:
67+ device_type = detect_device(None)
68+
69+
70 def recover(device_name):
71 try:
72 device = device_info.get_device(device_name)
73@@ -87,6 +95,10 @@
74 if state in ('device'):
75 try:
76 device.check_adb_shell()
77+ # XXX psivaa 20150910 We've seen instances when
78+ # detect_device throwing exceptions even when adb_shell working OK
79+ # recover it fully in such a situation
80+ get_device_type()
81 except:
82 # The device looks like it's available, but not responding
83 return _full_recovery(device)

Subscribers

People subscribed via source and target branches