Merge lp:~pwlars/ubuntu-test-cases/user-adb-support into lp:ubuntu-test-cases/touch

Proposed by Paul Larson
Status: Merged
Merged at revision: 275
Proposed branch: lp:~pwlars/ubuntu-test-cases/user-adb-support
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 124 lines (+18/-14)
5 files modified
scripts/jenkins.sh (+5/-5)
scripts/provision.sh (+6/-3)
scripts/run-autopilot-tests.sh (+4/-4)
scripts/run-smoke (+2/-1)
utils/target/prepare-autopilot-test.sh (+1/-1)
To merge this branch: bzr merge lp:~pwlars/ubuntu-test-cases/user-adb-support
Reviewer Review Type Date Requested Status
Para Siva (community) Approve
Review via email: mp+225893@code.launchpad.net

Description of the change

I want to go ahead and throw this out there for review, but I'm not 100% confident in it just yet, so please don't merge *yet*.

This adds support for the upcoming changes that will make adb run as the phablet user rather than root. For CI, that means that when we turn on developer mode to get adb at all, and adb to the device, we will be running as the phablet user rather than root, and the phablet user will not come preconfigured with NOPASSWD sudo.

This MP first enables NOPASSWD sudo for the phablet user (with the assumption that we will use --password phablet for udf when it is supported). It also changes the calls to adb shell so that we make no assumptions about whether we are running as phablet or root.

I've run through it without the updated adbd and it appears to be happy with our current environment. I've also manually installed an image with the updated adbd from ogra and bypassed the udf line to have it run provision as if the image had already been installed. The only problem I hit so far on this with provision was the call to phablet-network fails because it tries to push the network config without proper permissions. Since we are relying on those tools like everyone else, I'm assuming they will be fixed up as part of the upcoming change.

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

Just one question inline, but looks fine by me otherwise.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/jenkins.sh'
2--- scripts/jenkins.sh 2014-07-01 21:31:23 +0000
3+++ scripts/jenkins.sh 2014-07-07 21:18:41 +0000
4@@ -93,7 +93,7 @@
5 adb shell "top -n1 -b" > ${RESDIR}/top.log
6
7 set -x
8- adb shell 'rm -f /var/crash/*'
9+ adb shell 'sudo rm -f /var/crash/*'
10 if [ -z $QUICK ] ; then
11 # get the phone in sane place
12 adb reboot
13@@ -104,19 +104,19 @@
14 sleep 5
15 adb wait-for-device
16 phablet-network --skip-setup -t 90s
17- adb shell powerd-cli active &
18+ adb shell sudo powerd-cli active &
19 PIDS="$PIDS $!"
20- adb shell powerd-cli display on &
21+ adb shell sudo powerd-cli display on &
22 PIDS="$PIDS $!"
23 else
24 echo "SKIPPING phone reboot..."
25 fi
26
27- ${BASEDIR}/utils/host/adb-shell "aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules"
28+ ${BASEDIR}/utils/host/adb-shell "sudo aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules"
29
30 echo "launching test from the host...."
31 test_from_host
32- adb shell 'rm -f /var/crash/*'
33+ adb shell 'sudo rm -f /var/crash/*'
34
35 if ! `grep "^errors: [!0]" < $UTAHFILE >/dev/null` ; then
36 echo "errors found"
37
38=== modified file 'scripts/provision.sh'
39--- scripts/provision.sh 2014-06-24 20:04:02 +0000
40+++ scripts/provision.sh 2014-07-07 21:18:41 +0000
41@@ -34,8 +34,8 @@
42 image_info() {
43 # mark the version we installed in /home/phablet/.ci-[uuid,flash-args]
44 # adb shell messes up \n's with \r\n's so do the whole of the regex on the target
45- IMAGEVER=$(adb shell "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:")
46- CHAN=$(adb shell "system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:")
47+ 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:")
48+ CHAN=$(adb shell "sudo system-image-cli -i | sed -n -e 's/channel: \(.*\)/\1/p' | paste -s -d:")
49 REV=$(echo $IMAGEVER | cut -d: -f1)
50 echo "$IMAGE_OPT" | grep -q "\-\-revision" || IMAGE_OPT="${IMAGE_OPT} --revision $REV"
51 echo "$IMAGE_OPT" | grep -q "\-\-channel" || IMAGE_OPT="${IMAGE_OPT} --channel $CHAN"
52@@ -119,6 +119,9 @@
53 ${BASEDIR}/reboot-and-wait
54 fi
55
56+log "SETTING UP SUDO"
57+adb shell "echo phablet |sudo -S bash -c 'echo phablet ALL=\(ALL\) NOPASSWD: ALL > /etc/sudoers.d/phablet && chmod 600 /etc/sudoers.d/phablet'"
58+
59 log "SETTING UP CLICK PACKAGES"
60 phablet-click-test-setup
61
62@@ -139,5 +142,5 @@
63 log "CUSTOMIZING IMAGE"
64 phablet-config writable-image $CUSTOMIZE
65 # Make sure whoopsie-upload-all can work (bug #1245524)
66- adb shell "sed -i '/Waiting for whoopsie/ a\ subprocess.call([\"restart\", \"whoopsie\"])' /usr/share/apport/whoopsie-upload-all"
67+ adb shell "sudo sed -i '/Waiting for whoopsie/ a\ subprocess.call([\"restart\", \"whoopsie\"])' /usr/share/apport/whoopsie-upload-all"
68 fi
69
70=== modified file 'scripts/run-autopilot-tests.sh'
71--- scripts/run-autopilot-tests.sh 2014-07-01 21:31:23 +0000
72+++ scripts/run-autopilot-tests.sh 2014-07-07 21:18:41 +0000
73@@ -107,10 +107,10 @@
74 if [ -z $QUICK ] ; then
75 reboot-and-unlock.sh
76 FILES="/var/crash/* /home/phablet/.cache/upstart/*.log*"
77- if ! adb shell "rm -rf $FILES" ; then
78+ if ! adb shell "sudo rm -rf $FILES" ; then
79 log_error "unable to remove crash and log files, retrying"
80 adb wait-for-device
81- adb shell "rm -rf $FILES"
82+ adb shell "sudo rm -rf $FILES"
83 fi
84 else
85 echo "SKIPPING phone reboot..."
86@@ -120,9 +120,9 @@
87 if [ -z $USE_EMULATOR ] ; then
88 grab_powerd() {
89 echo "grabbing powerd cli locks..."
90- adb shell powerd-cli active &
91+ adb shell sudo powerd-cli active &
92 PIDS="$!"
93- adb shell powerd-cli display on &
94+ adb shell sudo powerd-cli display on &
95 PIDS="$PIDS $!"
96 }
97
98
99=== modified file 'scripts/run-smoke'
100--- scripts/run-smoke 2014-05-19 17:05:08 +0000
101+++ scripts/run-smoke 2014-07-07 21:18:41 +0000
102@@ -187,7 +187,8 @@
103
104
105 def _image_info():
106- info = subprocess.check_output(['adb', 'shell', 'system-image-cli', '-i'])
107+ info = subprocess.check_output(['adb', 'shell', 'sudo',
108+ 'system-image-cli', '-i'])
109 v_ver = u_ver = d_ver = channel = None
110 for line in info.split('\n'):
111 if not line.strip():
112
113=== modified file 'utils/target/prepare-autopilot-test.sh'
114--- utils/target/prepare-autopilot-test.sh 2014-04-15 15:18:23 +0000
115+++ utils/target/prepare-autopilot-test.sh 2014-07-07 21:18:41 +0000
116@@ -8,7 +8,7 @@
117 MISSING=0
118 dpkg -s $PKGS 2>/dev/null >/dev/null || MISSING=1
119 if [ $MISSING -eq 1 ] ; then
120- apt-get install -yq --force-yes $PKGS
121+ sudo apt-get install -yq --force-yes $PKGS
122 else
123 echo "setup not needed"
124 fi

Subscribers

People subscribed via source and target branches