Merge lp:~sergiusens/phablet-tools/test_update into lp:phablet-tools

Proposed by Sergio Schvezov
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 134
Merged at revision: 134
Proposed branch: lp:~sergiusens/phablet-tools/test_update
Merge into: lp:phablet-tools
Diff against target: 115 lines (+10/-40)
1 file modified
phablet-test-run (+10/-40)
To merge this branch: bzr merge lp:~sergiusens/phablet-tools/test_update
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Omer Akram (community) Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+175355@code.launchpad.net

Commit message

Update tests for upstart sessions.

Description of the change

You may need to bootstrap (phablet-flash -b) to get a working environment.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

23 +exec_with_adb_user() {
24 + adb -s $ANDROID_SERIAL shell sudo -u $USER -i sh -lc \'"$@"\'

This only accepts the first argument i.e. "exec_with_adb_user initctl stop unity8" only executes "exec_with_adb_user initctl"

Also phablet-test-run still does not work for me, I tried to run tests locally i.e. by ssh into the phone and the test suite runs fine but fails with phablet-test-run. logs here: http://paste.ubuntu.com/5885305/

review: Needs Fixing
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> 23 +exec_with_adb_user() {
> 24 + adb -s $ANDROID_SERIAL shell sudo -u $USER -i sh -lc \'"$@"\'
>
> This only accepts the first argument i.e. "exec_with_adb_user initctl stop
> unity8" only executes "exec_with_adb_user initctl"

Are you sure? Add an echo $@ above that line

> Also phablet-test-run still does not work for me, I tried to run tests locally
> i.e. by ssh into the phone and the test suite runs fine but fails with
> phablet-test-run. logs here: http://paste.ubuntu.com/5885305/

Did you phablet-flash -b ?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> Also phablet-test-run still does not work for me, I tried to run tests locally
> i.e. by ssh into the phone and the test suite runs fine but fails with
> phablet-test-run. logs here: http://paste.ubuntu.com/5885305/

Regarding the specifics of this, it fails because the DBUS_SESSION_BUS_ADDRESS is not exported correctly.

correction, you should phablet-flash -b --pending

133. By Sergio Schvezov

Explicitly importing DBUS_SESSION_BUS_ADDRESS until proper solution in place.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Worked for me.

review: Approve
Revision history for this message
Omer Akram (om26er) wrote :

Now works fine for me as well.

review: Approve
134. By Sergio Schvezov

Fixes for ubuntu root

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-test-run'
2--- phablet-test-run 2013-06-28 13:35:21 +0000
3+++ phablet-test-run 2013-07-18 14:23:27 +0000
4@@ -26,10 +26,6 @@
5 SETUPDEVICE=0
6 NOSHELL=0
7 RETVAL=0
8-SERVICEFILE="/etc/device-services"
9-FLIPPED=0
10-CHROOTDIR="/data/ubuntu"
11-CHROOTCMD="chroot $CHROOTDIR"
12
13 print_usage() {
14 cat << EOF
15@@ -52,11 +48,15 @@
16 }
17
18 exec_with_ssh() {
19- ssh -o NoHostAuthenticationForLocalhost=yes -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"$@\""
20+ ssh -o NoHostAuthenticationForLocalhost=yes -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"source .cache/upstart/dbus-session; export DBUS_SESSION_BUS_ADDRESS; $@\""
21 }
22
23 exec_with_adb() {
24- adb -s $ANDROID_SERIAL shell $CHROOTCMD /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
25+ adb -s $ANDROID_SERIAL shell /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
26+}
27+
28+exec_with_adb_user() {
29+ adb -s $ANDROID_SERIAL shell sudo -u $USER -i sh -lc \'"$@"\'
30 }
31
32 adb_root() {
33@@ -87,7 +87,7 @@
34 for PACKAGEPATH in $LOCALPACKAGES; do
35 PACKAGE=$(basename $PACKAGEPATH)
36 echo "Pushing $PACKAGE..."
37- adb push $PACKAGEPATH /data/ubuntu/tmp/phablet-run-test/
38+ adb push $PACKAGEPATH /tmp/phablet-run-test/
39 PACKAGELIST="$PACKAGELIST /tmp/phablet-run-test/$PACKAGE"
40 done
41 exec_with_adb dpkg -i $PACKAGELIST
42@@ -95,26 +95,11 @@
43 }
44
45 disable_shell() {
46- service="unity8"
47- if [ -n "$(adb -s $ANDROID_SERIAL shell "grep -w $service /etc/device-services" 2>/dev/null)" ]; then
48- echo "Stopping Shell..."
49- adb -s $ANDROID_SERIAL shell cp $SERVICEFILE $SERVICEFILE.backup
50- adb -s $ANDROID_SERIAL shell sed -i /unity8/d $SERVICEFILE
51- if [ $FLIPPED -eq 0 ]; then
52- adb -s $ANDROID_SERIAL shell "$CHROOTCMD /usr/bin/service ubuntu-session restart > /dev/null"
53- else
54- adb -s $ANDROID_SERIAL shell "$CHROOTCMD /sbin/restart ubuntu-touch-session > /dev/null"
55- fi
56- fi
57+ exec_with_adb_user initctl stop unity8
58 }
59
60 restore_shell() {
61- adb -s $ANDROID_SERIAL shell cp $SERVICEFILE.backup $SERVICEFILE
62- if [ $FLIPPED -eq 0 ]; then
63- adb -s $ANDROID_SERIAL shell "$CHROOTCMD /usr/bin/service ubuntu-session restart > /dev/null"
64- else
65- adb -s $ANDROID_SERIAL shell "$CHROOTCMD /sbin/restart ubuntu-touch-session > /dev/null"
66- fi
67+ exec_with_adb_user initctl start unity8
68 }
69
70 run_test() {
71@@ -124,7 +109,7 @@
72 exec_with_ssh autopilot run -o /tmp/test_results.xml -f xml $TESTSUITE
73 RETVAL=$?
74 echo "***** Test summary *****"
75- exec_with_adb head -n 1 /data/ubuntu/tmp/test_results.xml
76+ exec_with_adb head -n 1 /tmp/test_results.xml
77 else
78 exec_with_ssh autopilot run $TESTSUITE
79 RETVAL=$?
80@@ -145,14 +130,6 @@
81 fi
82 }
83
84-is_flipped() {
85- # Checks if the devices uses a flipped image
86- #
87- # @return: 0 if image is flipped 1 otherwise
88- [ -n "$(adb -s $ANDROID_SERIAL shell "ls /etc/lsb-release 2>/dev/null")" ] && return 0
89- return 1
90-}
91-
92 while getopts a:c:hino:p:s: opt; do
93 case $opt in
94 a)
95@@ -186,7 +163,6 @@
96 shift $((OPTIND - 1))
97
98 TESTSUITE=$1
99-SERVICEFILE="${CHROOTDIR}/$SERVICEFILE"
100
101 if test -z $ANDROID_SERIAL; then
102 ANDROID_SERIAL=$(adb devices -l | grep usb | cut -f 1 -d " " | head -n1)
103@@ -195,12 +171,6 @@
104
105 adb_root
106
107-if is_flipped; then
108- FLIPPED=1
109- CHROOTDIR=""
110- CHROOTCMD=""
111-fi
112-
113 if [ $SETUPDEVICE -eq 1 ]; then
114 exec_with_adb add-apt-repository -y ppa:autopilot/ppa
115 exec_with_adb apt-get -qq update

Subscribers

People subscribed via source and target branches