Merge lp:~fginther/ubuntu-test-cases/add-reminders into lp:ubuntu-test-cases/touch
- add-reminders
- Merge into touch
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 |
Related bugs: |
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-
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.
Paul Larson (pwlars) wrote : | # |
I'm seeing 7 tests, 4 pass, 3 fail. Does this match with what they were expecting?
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.
Paul Larson (pwlars) wrote : | # |
No, they are on a freshly flashed phone with no other tests running
Paul Larson (pwlars) wrote : | # |
Does reminders-app have any .deb dependencies that need to be installed?
Leo Arias (elopio) wrote : | # |
Yes, they need evernote-
I couldn't give them a try on friday, I'm sorry. Can you paste the output
of your failures somewhere?
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.
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.
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.
Leo Arias (elopio) wrote : | # |
Sorry, scratch all I said. The thrift and evernote modules now are copied to the same reminders python package.
David Planella (dpm) wrote : | # |
We're already including the Python Evernote SDK in the sources, and they're available in the reminders-
If you need this to be included in the click package instead, I guess it shouldn't be much of a problem.
Paul Larson (pwlars) wrote : | # |
Perhaps there are other dependencies still needed then? Running it with phablet-test-run locally, I get.
http://
...
File "/home/
from requests_oauthlib import OAuth1Session
ImportError: No module named 'requests_oauthlib'
If I manually install python-
File "/home/
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/
session = Signon.
TypeError: Argument 1 does not allow None as a value
Leo Arias (elopio) wrote : | # |
Yes, that's python3-
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.
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.
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:/
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.
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.
Nicholas Skaggs (nskaggs) wrote : | # |
Just updating to say this should be good to go. Trunk should work properly on the device.
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.
Francis Ginther (fginther) wrote : | # |
I've cleaned up based on my earlier comments or decided to see if it's good 'nuf.
Francis Ginther (fginther) wrote : | # |
This is much reworked since the original, marking with a resubmit.
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/
adt-run [23:29:27]: version 3.2.3-0~
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/
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/
+ adt_log=adt-run [23:29:27]: version 3.2.3-0~
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/
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=
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/
adt-run [23:30:32]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n'
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=
Note, a couple things. You can shorten "ssh -s /usr/share/
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://
You can see the ssh connection fails:
+ cleanup
+ adb -s 00693fd555c9186a shell pkill powerd-cli
<VirtSubproc>: failure: ['/var/
adt-run [12:14:39]: ERROR: testbed failed: cannot send to testbed: ['BrokenPipeError: [Errno 32] Broken pipe\n'
Nicholas Skaggs (nskaggs) wrote : | # |
@pitii, can you review the log above and give your thoughts on what is still broken here?
Martin Pitt (pitti) wrote : | # |
The pastebin seems to use a local version of the setup script: /var/lib/
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?
Martin Pitt (pitti) wrote : | # |
D'oh, I should have read the set -x more carefully. It's ssh-keygen that failed. Fixed in http://
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!
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.
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?
Nicholas Skaggs (nskaggs) wrote : | # |
The new run is complete, similar errors.
http://
Can you have a look pitti?
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?
Martin Pitt (pitti) wrote : | # |
Automatic key generation is now done: http://
Nicholas Skaggs (nskaggs) wrote : | # |
Looks like the run with a pre-generated key works:
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://
can you update the mp?
Martin Pitt (pitti) wrote : | # |
For the record, Nick and I now figured out how to invoke autopilot usefully with creating a subunit stream: http://
This will land in <output-
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
1 | === modified file 'jenkins/testconfig.py' | |||
2 | --- jenkins/testconfig.py 2014-07-25 22:15:49 +0000 | |||
3 | +++ jenkins/testconfig.py 2014-07-31 21:33:54 +0000 | |||
4 | @@ -45,6 +45,18 @@ | |||
5 | 45 | self.app = app | 45 | self.app = app |
6 | 46 | 46 | ||
7 | 47 | 47 | ||
8 | 48 | class AutopkgTest(Test): | ||
9 | 49 | def __init__(self, name, branch, click): | ||
10 | 50 | Test.__init__(self, name) | ||
11 | 51 | # In all known cases, the app and name are equivalent | ||
12 | 52 | self.app = name | ||
13 | 53 | # Branch is needed until autpkgtest supports downloading | ||
14 | 54 | # from the branch in the manifest file | ||
15 | 55 | self.branch = branch | ||
16 | 56 | # This is the click name as returned by 'click list' | ||
17 | 57 | self.click = click | ||
18 | 58 | |||
19 | 59 | |||
20 | 48 | TESTSUITES = [ | 60 | TESTSUITES = [ |
21 | 49 | Test('default'), | 61 | Test('default'), |
22 | 50 | ] | 62 | ] |
23 | @@ -77,6 +89,10 @@ | |||
24 | 77 | ['ubuntu-system-settings-online-accounts-autopilot']), | 89 | ['ubuntu-system-settings-online-accounts-autopilot']), |
25 | 78 | ] | 90 | ] |
26 | 79 | TESTSUITES += [ | 91 | TESTSUITES += [ |
27 | 92 | AutopkgTest('reminders', 'lp:reminders-app', | ||
28 | 93 | 'com.ubuntu.reminders'), | ||
29 | 94 | ] | ||
30 | 95 | TESTSUITES += [ | ||
31 | 80 | Test('click_image_tests'), | 96 | Test('click_image_tests'), |
32 | 81 | Test('sdk'), | 97 | Test('sdk'), |
33 | 82 | Test('security'), | 98 | Test('security'), |
34 | @@ -135,6 +151,7 @@ | |||
35 | 135 | 151 | ||
36 | 136 | def _handle_ap_apps(args): | 152 | def _handle_ap_apps(args): |
37 | 137 | tests = _get_tests(APTest, args.image_type) | 153 | tests = _get_tests(APTest, args.image_type) |
38 | 154 | tests += _get_tests(AutopkgTest, args.image_type) | ||
39 | 138 | tests = _split_work(tests, args.total_workers, args.worker) | 155 | tests = _split_work(tests, args.total_workers, args.worker) |
40 | 139 | print(' '.join([t.app for t in tests])) | 156 | print(' '.join([t.app for t in tests])) |
41 | 140 | 157 | ||
42 | @@ -149,6 +166,18 @@ | |||
43 | 149 | print(' '.join(pkgs)) | 166 | print(' '.join(pkgs)) |
44 | 150 | 167 | ||
45 | 151 | 168 | ||
46 | 169 | def _handle_autopkg_apps(args): | ||
47 | 170 | tests = _get_tests(AutopkgTest, args.image_type) | ||
48 | 171 | for test in tests: | ||
49 | 172 | if test.app == args.branch: | ||
50 | 173 | print(test.branch) | ||
51 | 174 | return | ||
52 | 175 | elif test.app == args.click: | ||
53 | 176 | print(test.click) | ||
54 | 177 | return | ||
55 | 178 | print(' '.join([t.app for t in tests])) | ||
56 | 179 | |||
57 | 180 | |||
58 | 152 | def get_tests_mako(common_tests): | 181 | def get_tests_mako(common_tests): |
59 | 153 | tests = common_tests | 182 | tests = common_tests |
60 | 154 | tests.extend([DevTest('suspend-blocker', 'mako-01')]) | 183 | tests.extend([DevTest('suspend-blocker', 'mako-01')]) |
61 | @@ -188,6 +217,16 @@ | |||
62 | 188 | p.add_argument('-w', '--worker', type=int, default=0, | 217 | p.add_argument('-w', '--worker', type=int, default=0, |
63 | 189 | help='The worker to allocate applications for testing to.') | 218 | help='The worker to allocate applications for testing to.') |
64 | 190 | 219 | ||
65 | 220 | p = sub.add_parser('adt', help='List autopkgtest application names') | ||
66 | 221 | p.set_defaults(func=_handle_autopkg_apps) | ||
67 | 222 | g = p.add_mutually_exclusive_group() | ||
68 | 223 | g.add_argument('-i', '--image-type', | ||
69 | 224 | help='Return list of test configured for an image type.') | ||
70 | 225 | g.add_argument('-b', '--branch', | ||
71 | 226 | help='Return the branch needed for an autopkgtest app.') | ||
72 | 227 | g.add_argument('-c', '--click', | ||
73 | 228 | help='Return the click name for an autopkgtest app.') | ||
74 | 229 | |||
75 | 191 | p = sub.add_parser('packages', help='List packages required for autopilot') | 230 | p = sub.add_parser('packages', help='List packages required for autopilot') |
76 | 192 | p.set_defaults(func=_handle_ap_packages) | 231 | p.set_defaults(func=_handle_ap_packages) |
77 | 193 | g = p.add_mutually_exclusive_group() | 232 | g = p.add_mutually_exclusive_group() |
78 | 194 | 233 | ||
79 | === modified file 'scripts/run-autopilot-tests.sh' | |||
80 | --- scripts/run-autopilot-tests.sh 2014-07-01 21:31:23 +0000 | |||
81 | +++ scripts/run-autopilot-tests.sh 2014-07-31 21:33:54 +0000 | |||
82 | @@ -76,7 +76,37 @@ | |||
83 | 76 | [ -d $odir ] && rm -rf $odir | 76 | [ -d $odir ] && rm -rf $odir |
84 | 77 | mkdir -p $odir || return 1 | 77 | mkdir -p $odir || return 1 |
85 | 78 | 78 | ||
86 | 79 | # The source_dir is needed for adt-run and click packages | ||
87 | 80 | source_dir=${RESDIR}/source_dir | ||
88 | 81 | [ -d $source_dir ] && rm -rf $source_dir | ||
89 | 82 | |||
90 | 79 | system_settle before $odir | 83 | system_settle before $odir |
91 | 84 | |||
92 | 85 | adt_list=$(${BASEDIR}/jenkins/testconfig.py adt) | ||
93 | 86 | if echo "$adt_list" | grep "$app" ; then | ||
94 | 87 | echo "$app is executed with adt-run" | ||
95 | 88 | test_app_adt $source_dir | ||
96 | 89 | else | ||
97 | 90 | echo "$app is executed with phablet-test-run" | ||
98 | 91 | test_app_ptr | ||
99 | 92 | fi | ||
100 | 93 | |||
101 | 94 | system_settle after $odir | ||
102 | 95 | |||
103 | 96 | if echo "$adt_list" | grep "$app" ; then | ||
104 | 97 | echo "Clean up for adt tests" | ||
105 | 98 | [ -d $source_dir ] && rm -rf $source_dir | ||
106 | 99 | else | ||
107 | 100 | echo "Clean up for ptr tests" | ||
108 | 101 | setup_test $app teardown $odir | ||
109 | 102 | fi | ||
110 | 103 | if [ -f ${odir}/test_results.subunit ] ; then | ||
111 | 104 | cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml | ||
112 | 105 | fi | ||
113 | 106 | ${BASEDIR}/scripts/combine_results ${odir} | ||
114 | 107 | } | ||
115 | 108 | |||
116 | 109 | test_app_ptr() { | ||
117 | 80 | phablet-config autopilot --dbus-probe enable || \ | 110 | phablet-config autopilot --dbus-probe enable || \ |
118 | 81 | (log_error "'autopilot dbus-probe enable' failed"; return 1) | 111 | (log_error "'autopilot dbus-probe enable' failed"; return 1) |
119 | 82 | 112 | ||
120 | @@ -94,13 +124,40 @@ | |||
121 | 94 | -a /var/crash -a /home/phablet/.cache/upstart \ | 124 | -a /var/crash -a /home/phablet/.cache/upstart \ |
122 | 95 | -a /var/log/syslog -a /var/log/kern.log \ | 125 | -a /var/log/syslog -a /var/log/kern.log \ |
123 | 96 | -v $app || true | 126 | -v $app || true |
124 | 127 | } | ||
125 | 97 | 128 | ||
130 | 98 | system_settle after $odir | 129 | test_app_adt() { |
131 | 99 | setup_test $app teardown $odir | 130 | # Here's the basic command for running adt tests for a click package. |
132 | 100 | if [ -f ${odir}/test_results.subunit ] ; then | 131 | # Due to limitation in adt-run, the source dir has to be manually |
133 | 101 | cat ${odir}/test_results.subunit | subunit2junitxml > ${odir}/test_results.xml | 132 | # checked out. |
134 | 133 | # adt-run -o reminders.out --click-source=reminders-app \ | ||
135 | 134 | # --click=com.ubuntu.reminders --- \ | ||
136 | 135 | # ssh -s /usr/share/autopkgtest/ssh-setup/adb | ||
137 | 136 | click_source_dir=$1 | ||
138 | 137 | click_name=$(${BASEDIR}/jenkins/testconfig.py adt --click $app) | ||
139 | 138 | # TODO: check out the correct revno based on the click manifest | ||
140 | 139 | click_source=$(${BASEDIR}/jenkins/testconfig.py adt --branch $app) | ||
141 | 140 | bzr branch $click_source $click_source_dir | ||
142 | 141 | adt-run -o ${odir} --click-source=$click_source_dir \ | ||
143 | 142 | --click=$click_name --- \ | ||
144 | 143 | ssh -s /usr/share/autopkgtest/ssh-setup/adb | ||
145 | 144 | adt_ret=$? | ||
146 | 145 | echo "adt-run returned: $adt_ret" | ||
147 | 146 | # adt-run does not produce any pretty xml results. | ||
148 | 147 | # As a workaround, construct an xml file that can at least be pulled | ||
149 | 148 | # into the dashboard and contains data from any test failures. | ||
150 | 149 | if [ $adt_ret -eq 0 ] || [ $adt_ret -eq 2 ] ; then | ||
151 | 150 | # adt-run passed! | ||
152 | 151 | # non-failure exit status: | ||
153 | 152 | # 0 == all tests passed | ||
154 | 153 | # 2 == at least one test skipped | ||
155 | 154 | echo "<testsuite errors=\"0\" failures=\"0\" tests=\"1\"><testcase classname=\"$app\" name=\"adt-run\"></testcase></testsuite>" >> ${odir}/test_results.xml | ||
156 | 155 | else | ||
157 | 156 | # The adt run failed. The log file will contain the logging | ||
158 | 157 | # from the test failures as well as any adt-run failures. | ||
159 | 158 | adt_log=`cat ${odir}/log` | ||
160 | 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 | ||
161 | 102 | fi | 160 | fi |
162 | 103 | ${BASEDIR}/scripts/combine_results ${odir} | ||
163 | 104 | } | 161 | } |
164 | 105 | 162 | ||
165 | 106 | reboot_wait() { | 163 | reboot_wait() { |
please merge by hand. we have no tarmac landing here