Merge lp:~fginther/ubuntu-test-cases/add-reminders into lp:ubuntu-test-cases/touch

Proposed by Francis Ginther
Status: Needs review
Proposed branch: lp:~fginther/ubuntu-test-cases/add-reminders
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 165 lines (+101/-5)
2 files modified
jenkins/testconfig.py (+39/-0)
scripts/run-autopilot-tests.sh (+62/-5)
To merge this branch: bzr merge lp:~fginther/ubuntu-test-cases/add-reminders
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Needs Fixing
Paul Larson Needs Fixing
Francis Ginther Needs Resubmitting
Andy Doan (community) Approve
Martin Pitt Pending
Review via email: mp+226281@code.launchpad.net

Commit message

Add testing for reminders click app.

Description of the change

Add testing for reminders click app.

This requires the utopic version of autopkgtest or from ppa:canonical-ci-engineering/ci-airline-phase-0

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

please merge by hand. we have no tarmac landing here

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

Did you try running this locally or anything? Looks right, but last I had known reminders wasn't added yet. I always do a quick run-through by hand to make sure there are no surprises.

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

I'm seeing 7 tests, 4 pass, 3 fail. Does this match with what they were expecting?

Revision history for this message
Leo Arias (elopio) wrote :

Paul, are you running the tests on the phone freshly flashed? They should all pass.
If you are running them on the desktop without your keyring unlocked, you will get errors on the ones that require credentials. They will fail also if you already have an evernote account.
Those details are on TODO.
I'm about to go to bed, but tomorrow I can take a look at your errors.

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

No, they are on a freshly flashed phone with no other tests running

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

Does reminders-app have any .deb dependencies that need to be installed?

Revision history for this message
Leo Arias (elopio) wrote :

Yes, they need evernote-sdk-python3 that's on the applications PPA.
I couldn't give them a try on friday, I'm sorry. Can you paste the output
of your failures somewhere?

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

Ok, it turns out this is all due to a bug. phablet-test-run is trying to import reminders to decide if it's python2 or python3, and due to the deprecation warning from uitk, it decides to run python2, which is not even installed. xnox has a fix for this in phablet-tools and is going to get it landed. I suspect there are other tests like this too, and we were just getting lucky enough with them to run them after something that depended on python2 and installed it.

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

Wait, do I understand correctly that for these tests to pass, we would need to install a package from some other ppa? That's a bit of a problem since clicks don't have dependencies. We could hack this in somehow, but it's *really* not ideal. Having it in the image, or at least in the source tree would probably be ideal. Otherwise, if we need to hack around it and force the install of a deb before running tests on a click package, we'll at least need it in the archives, not a ppa.

Revision history for this message
Leo Arias (elopio) wrote :

We need to involve balloons and dpm in this discussion. On option was to copy the evernote python module to the package, but I'm not sure if their license allows us to do it. And the alternative is to make our own python module to communicate with their API, less than ideal because we would need to maintain it.

Revision history for this message
Leo Arias (elopio) wrote :

Sorry, scratch all I said. The thrift and evernote modules now are copied to the same reminders python package.

Revision history for this message
David Planella (dpm) wrote :

We're already including the Python Evernote SDK in the sources, and they're available in the reminders-app-autopilot binary generated from the reminders-app source package [1] in the utopic archive.

If you need this to be included in the click package instead, I guess it shouldn't be much of a problem.

[1] https://launchpad.net/ubuntu/+source/reminders-app

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

Perhaps there are other dependencies still needed then? Running it with phablet-test-run locally, I get.

http://paste.ubuntu.com/7799766/
...
File "/home/phablet/autopilot/evernote/api/client.py", line 5, in <module>
from requests_oauthlib import OAuth1Session
ImportError: No module named 'requests_oauthlib'

If I manually install python-requests-oauthlib, I can get a bit further, but I still get:
File "/home/phablet/autopilot/reminders/fake_services.py", line 22, in <module>
import dbusmock
ImportError: No module named 'dbusmock'

I can install python3-dbusmock, but it pulls in the notorious dbus-x11 that's known to cause problems in the past. Even if I install that manually and try again though, I still get:
File "/home/phablet/autopilot/reminders/credentials.py", line 133, in _process_session
session = Signon.AuthSession.new(identity, method)
TypeError: Argument 1 does not allow None as a value

Revision history for this message
Leo Arias (elopio) wrote :

Yes, that's python3-requests-oauthlib and python3-dbusmock.
The last error sounds familiar. Like when the oauth method was not available in online accounts. I'm now caught with the hack fest, so I can't try it atm.

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

Given the need to install additional dependencies before running these tests with phablet-test-run or executing them with adt-run, this MP is clearly not sufficient.

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I'll note I'm working on migrating reminders to adt run (it was the last one). With adt-run this will work fine as depends are properly handled. The old way of running didn't/doesn't allow for depends, thus the failures.

https://code.launchpad.net/~nskaggs/reminders-app/autopkgtest/+merge/226894

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

I've added some very hackish support for running autopkgtests. There are a number of hacks in here that should be fixed before merging. But I wanted to push something now that it's actually usable.

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

@Francis, if you wish, try this branch lp:~nskaggs/reminders-app/workaround-1347905, and confirm if indeed the tests will now run in jenkins.

It disables the tests that fail on the device, and fixes the hanging and launching issues.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Just updating to say this should be good to go. Trunk should work properly on the device.

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

I successfully tested with nskaggs's branch mentioned above. Got a fully passing reminders test.

Now I just need to clean this up.

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

I've cleaned up based on my earlier comments or decided to see if it's good 'nuf.

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

This is much reworked since the original, marking with a resubmit.

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

I don't know too much about the adb backend for adt-run. Maybe one of you can shed some light on this. But I'm guessing maybe it needs to know which adb device it's connecting to? Does it let you specify the serial somehow?
+ adt-run -o /var/lib/jenkins/slaves/mako-10/workspace/plars-smoke-daily-test/clientlogs/reminders --click-source=/var/lib/jenkins/slaves/mako-10/workspace/plars-smoke-daily-test/clientlogs/source_dir --click=com.ubuntu.reminders --- ssh -s /usr/share/autopkgtest/ssh-setup/adb
adt-run [23:29:27]: version 3.2.3-0~795~ubuntu14.04.1
Waiting for device ADB to appear...

Configuring Ubuntu phone for testing...

Preparing Ubuntu phone for running tests...
Waiting for desktop to boot

<VirtSubproc>: failure: ['/usr/share/autopkgtest/ssh-setup/adb', 'open'] failed (exit status 255)
adt-run [23:30:32]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n']
+ adt_ret=16
+ echo adt-run returned: 16
adt-run returned: 16
+ [ 16 -eq 0 ]
+ [ 16 -eq 2 ]
+ cat /var/lib/jenkins/slaves/mako-10/workspace/plars-smoke-daily-test/clientlogs/reminders/log
+ adt_log=adt-run [23:29:27]: version 3.2.3-0~795~ubuntu14.04.1
Waiting for device ADB to appear...
Configuring Ubuntu phone for testing...
Preparing Ubuntu phone for running tests...
Waiting for desktop to boot
<VirtSubproc>: failure: ['/usr/share/autopkgtest/ssh-setup/adb', 'open'] failed (exit status 255)
adt-run [23:30:32]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n']
+ echo <testsuite errors="1" failures="0" tests="1"><testcase classname="reminders" name="adt-run"><failure type="adt-run.failure">adt-run encountered at least one failed test: <![CDATA[\nadt-run [23:29:27]: version 3.2.3-0~795~ubuntu14.04.1
Waiting for device ADB to appear...
Configuring Ubuntu phone for testing...
Preparing Ubuntu phone for running tests...
Waiting for desktop to boot
<VirtSubproc>: failure: ['/usr/share/autopkgtest/ssh-setup/adb', 'open'] failed (exit status 255)
adt-run [23:30:32]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n']\n\n]]></failure></testcase></testsuite>

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

@plars, yes you can pass the serial with --serial or -s. Here's an example of me doing it with calendar:

adt-run calendar-app/ --click=com.ubuntu.calendar --- ssh -s adb -- -s 0720a62b

Note, a couple things. You can shorten "ssh -s /usr/share/autopkgtest/ssh-setup/adb" to simple "ssh -s adb". Secondly, you need the -- in order to pass the -s argument to adb and not ssh.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

We discovered a bug with adt and how it handles --serial arguments improperly inside the adb script. This has been fixed in autopkgtest 3.3.2git1 which is in utopic. Sadly, errors still persist.

http://paste.ubuntu.com/7980971/

You can see the ssh connection fails:

+ cleanup
+ adb -s 00693fd555c9186a shell pkill powerd-cli
<VirtSubproc>: failure: ['/var/lib/jenkins/slaves/mako-12/workspace/plars-smoke-daily-test/add-reminders/scripts/adb-runner-debug', 'open', '-s', '00693fd555c9186a'] failed (exit status 255)
adt-run [12:14:39]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n']\n\n]]></failure></testcase></testsuite>

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

@pitii, can you review the log above and give your thoughts on what is still broken here?

Revision history for this message
Martin Pitt (pitti) wrote :

The pastebin seems to use a local version of the setup script: /var/lib/jenkins/slaves/mako-12/workspace/plars-smoke-daily-test/add-reminders/scripts/adb-runner-debug . However, that looks recent (i. e. updated to the latest autopkgtest).

I think the setup script is fine now. My hunch is that the "exit status 255" comes from a failure of ssh itself. We noticed that in our current jenkins autopkgtest setup as well, it needs to get passed one or two extra -t to allocate a terminal, otherwise ssh fails with that error. But that would be easier to see with "--- ssh --debug -s ...", i. e. enable debugging output for adt-virt-ssh. I don't see that locally presumably because running it from a terminal always has a proper tty for ssh, but that's not the case when running it in jenkins. I'll try to reproduce this locally and report back here.

In the meantime I have some inline comments about the changes here. Also, in that log there are a lot of packages installed with "apt-get install" on the device. Many (python 2 bits) aren't needed at all, and this also requires the device to be read-write. adt-run already does all that (in r/o mode), so could these bits be skipped with adt-run?

Revision history for this message
Martin Pitt (pitti) wrote :

D'oh, I should have read the set -x more carefully. It's ssh-keygen that failed. Fixed in http://anonscm.debian.org/cgit/autopkgtest/autopkgtest.git/commit/?id=ed8a8ff

But at least I checked adt-run in "nohup" and with "batch" now, and it seems to behave. Paul/Nick, can you please put that fix into your local adb-runner-debug and re-run? Thanks!

Revision history for this message
Martin Pitt (pitti) wrote :

Wrt. the summary, I'm happy to teach adt-run about producing an XML summary file as well. Please file a bug report, with a sketch of how such a file should look like.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Paul, I've updated lp:~nskaggs/ubuntu-test-cases/add-reminders, rev 264. It contains the cherrypicked fix from pitti. Can you re-run?

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

The new run is complete, similar errors.

http://paste.ubuntu.com/8098830/

Can you have a look pitti?

Revision history for this message
Martin Pitt (pitti) wrote :

No, it's a different issue now:

+ echo ~/.ssh/id_rsa.pub or ~/.ssh/id_rsa do not exist. Please generate a key

The current script assumes that you run this with an existing key. If there's none, it could certainly generate one, or generate a private one somewhere, I just didn't think of that. If that's a requirement I can look into that.

Otherwise, would it be possible to generate one there now, to see how much further it gets?

Revision history for this message
Martin Pitt (pitti) wrote :
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Looks like the run with a pre-generated key works:

http://paste.ubuntu.com/8099616/

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Francis, I believe you need to add just one of the tweaks from the branch; the one passing the serial along:

http://bazaar.launchpad.net/~nskaggs/ubuntu-test-cases/add-reminders/revision/258

can you update the mp?

review: Needs Fixing
Revision history for this message
Martin Pitt (pitti) wrote :

For the record, Nick and I now figured out how to invoke autopilot usefully with creating a subunit stream: http://anonscm.debian.org/cgit/autopkgtest/autopkgtest.git/commit/?id=f8ebaa

This will land in <output-dir>/artifacts/<testname>.subunit . This should then be published on Jenkins as an artifact?

I'll upload that as autopkgtest 3.3.3 now, will be in utopic tomorrow morning.

Unmerged revisions

257. By Francis Ginther

Revert ubuntu-calculator-app and filemanager back to ptr tests, make option handling more robust and do some cleanup.

256. By Francis Ginther

Add primitive support for running autopkgtests with run-autopilot-tests.sh. This includes modification of ubuntu-calculator-app and filemanager as examples.

255. By Francis Ginther

Create an AutopkgTest test classification and begin infrastructure to handle it.

254. By Francis Ginther

Add testing for reminders click app.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'jenkins/testconfig.py'
--- jenkins/testconfig.py 2014-07-25 22:15:49 +0000
+++ jenkins/testconfig.py 2014-07-31 21:33:54 +0000
@@ -45,6 +45,18 @@
45 self.app = app45 self.app = app
4646
4747
48class AutopkgTest(Test):
49 def __init__(self, name, branch, click):
50 Test.__init__(self, name)
51 # In all known cases, the app and name are equivalent
52 self.app = name
53 # Branch is needed until autpkgtest supports downloading
54 # from the branch in the manifest file
55 self.branch = branch
56 # This is the click name as returned by 'click list'
57 self.click = click
58
59
48TESTSUITES = [60TESTSUITES = [
49 Test('default'),61 Test('default'),
50]62]
@@ -77,6 +89,10 @@
77 ['ubuntu-system-settings-online-accounts-autopilot']),89 ['ubuntu-system-settings-online-accounts-autopilot']),
78]90]
79TESTSUITES += [91TESTSUITES += [
92 AutopkgTest('reminders', 'lp:reminders-app',
93 'com.ubuntu.reminders'),
94]
95TESTSUITES += [
80 Test('click_image_tests'),96 Test('click_image_tests'),
81 Test('sdk'),97 Test('sdk'),
82 Test('security'),98 Test('security'),
@@ -135,6 +151,7 @@
135151
136def _handle_ap_apps(args):152def _handle_ap_apps(args):
137 tests = _get_tests(APTest, args.image_type)153 tests = _get_tests(APTest, args.image_type)
154 tests += _get_tests(AutopkgTest, args.image_type)
138 tests = _split_work(tests, args.total_workers, args.worker)155 tests = _split_work(tests, args.total_workers, args.worker)
139 print(' '.join([t.app for t in tests]))156 print(' '.join([t.app for t in tests]))
140157
@@ -149,6 +166,18 @@
149 print(' '.join(pkgs))166 print(' '.join(pkgs))
150167
151168
169def _handle_autopkg_apps(args):
170 tests = _get_tests(AutopkgTest, args.image_type)
171 for test in tests:
172 if test.app == args.branch:
173 print(test.branch)
174 return
175 elif test.app == args.click:
176 print(test.click)
177 return
178 print(' '.join([t.app for t in tests]))
179
180
152def get_tests_mako(common_tests):181def get_tests_mako(common_tests):
153 tests = common_tests182 tests = common_tests
154 tests.extend([DevTest('suspend-blocker', 'mako-01')])183 tests.extend([DevTest('suspend-blocker', 'mako-01')])
@@ -188,6 +217,16 @@
188 p.add_argument('-w', '--worker', type=int, default=0,217 p.add_argument('-w', '--worker', type=int, default=0,
189 help='The worker to allocate applications for testing to.')218 help='The worker to allocate applications for testing to.')
190219
220 p = sub.add_parser('adt', help='List autopkgtest application names')
221 p.set_defaults(func=_handle_autopkg_apps)
222 g = p.add_mutually_exclusive_group()
223 g.add_argument('-i', '--image-type',
224 help='Return list of test configured for an image type.')
225 g.add_argument('-b', '--branch',
226 help='Return the branch needed for an autopkgtest app.')
227 g.add_argument('-c', '--click',
228 help='Return the click name for an autopkgtest app.')
229
191 p = sub.add_parser('packages', help='List packages required for autopilot')230 p = sub.add_parser('packages', help='List packages required for autopilot')
192 p.set_defaults(func=_handle_ap_packages)231 p.set_defaults(func=_handle_ap_packages)
193 g = p.add_mutually_exclusive_group()232 g = p.add_mutually_exclusive_group()
194233
=== modified file 'scripts/run-autopilot-tests.sh'
--- scripts/run-autopilot-tests.sh 2014-07-01 21:31:23 +0000
+++ scripts/run-autopilot-tests.sh 2014-07-31 21:33:54 +0000
@@ -76,7 +76,37 @@
76 [ -d $odir ] && rm -rf $odir76 [ -d $odir ] && rm -rf $odir
77 mkdir -p $odir || return 177 mkdir -p $odir || return 1
7878
79 # The source_dir is needed for adt-run and click packages
80 source_dir=${RESDIR}/source_dir
81 [ -d $source_dir ] && rm -rf $source_dir
82
79 system_settle before $odir83 system_settle before $odir
84
85 adt_list=$(${BASEDIR}/jenkins/testconfig.py adt)
86 if echo "$adt_list" | grep "$app" ; then
87 echo "$app is executed with adt-run"
88 test_app_adt $source_dir
89 else
90 echo "$app is executed with phablet-test-run"
91 test_app_ptr
92 fi
93
94 system_settle after $odir
95
96 if echo "$adt_list" | grep "$app" ; then
97 echo "Clean up for adt tests"
98 [ -d $source_dir ] && rm -rf $source_dir
99 else
100 echo "Clean up for ptr tests"
101 setup_test $app teardown $odir
102 fi
103 if [ -f ${odir}/test_results.subunit ] ; then
104 cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml
105 fi
106 ${BASEDIR}/scripts/combine_results ${odir}
107}
108
109test_app_ptr() {
80 phablet-config autopilot --dbus-probe enable || \110 phablet-config autopilot --dbus-probe enable || \
81 (log_error "'autopilot dbus-probe enable' failed"; return 1)111 (log_error "'autopilot dbus-probe enable' failed"; return 1)
82112
@@ -94,13 +124,40 @@
94 -a /var/crash -a /home/phablet/.cache/upstart \124 -a /var/crash -a /home/phablet/.cache/upstart \
95 -a /var/log/syslog -a /var/log/kern.log \125 -a /var/log/syslog -a /var/log/kern.log \
96 -v $app || true126 -v $app || true
127}
97128
98 system_settle after $odir129test_app_adt() {
99 setup_test $app teardown $odir130 # Here's the basic command for running adt tests for a click package.
100 if [ -f ${odir}/test_results.subunit ] ; then131 # Due to limitation in adt-run, the source dir has to be manually
101 cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml132 # checked out.
133 # adt-run -o reminders.out --click-source=reminders-app \
134 # --click=com.ubuntu.reminders --- \
135 # ssh -s /usr/share/autopkgtest/ssh-setup/adb
136 click_source_dir=$1
137 click_name=$(${BASEDIR}/jenkins/testconfig.py adt --click $app)
138 # TODO: check out the correct revno based on the click manifest
139 click_source=$(${BASEDIR}/jenkins/testconfig.py adt --branch $app)
140 bzr branch $click_source $click_source_dir
141 adt-run -o ${odir} --click-source=$click_source_dir \
142 --click=$click_name --- \
143 ssh -s /usr/share/autopkgtest/ssh-setup/adb
144 adt_ret=$?
145 echo "adt-run returned: $adt_ret"
146 # adt-run does not produce any pretty xml results.
147 # As a workaround, construct an xml file that can at least be pulled
148 # into the dashboard and contains data from any test failures.
149 if [ $adt_ret -eq 0 ] || [ $adt_ret -eq 2 ] ; then
150 # adt-run passed!
151 # non-failure exit status:
152 # 0 == all tests passed
153 # 2 == at least one test skipped
154 echo "<testsuite errors=\"0\" failures=\"0\" tests=\"1\"><testcase classname=\"$app\" name=\"adt-run\"></testcase></testsuite>" >> ${odir}/test_results.xml
155 else
156 # The adt run failed. The log file will contain the logging
157 # from the test failures as well as any adt-run failures.
158 adt_log=`cat ${odir}/log`
159 echo "<testsuite errors=\"1\" failures=\"0\" tests=\"1\"><testcase classname=\"$app\" name=\"adt-run\"><failure type=\"adt-run.failure\">adt-run encountered at least one failed test: <![CDATA[\n$adt_log\n\n]]></failure></testcase></testsuite>" >> ${odir}/test_results.xml
102 fi160 fi
103 ${BASEDIR}/scripts/combine_results ${odir}
104}161}
105162
106reboot_wait() {163reboot_wait() {

Subscribers

People subscribed via source and target branches