Merge lp:~barry/ubuntu-ota-tests/packaging into lp:ubuntu-ota-tests

Proposed by Barry Warsaw on 2015-03-18
Status: Merged
Approved by: Leo Arias on 2015-03-19
Approved revision: 21
Merged at revision: 12
Proposed branch: lp:~barry/ubuntu-ota-tests/packaging
Merge into: lp:ubuntu-ota-tests
Diff against target: 225 lines (+90/-11)
11 files modified
.bzrignore (+2/-0)
README.rst (+1/-1)
debian/changelog (+1/-1)
debian/compat (+1/-0)
debian/control (+23/-0)
debian/rules (+11/-0)
debian/tests/control (+3/-3)
debian/tests/ota-selftests (+0/-2)
setup.py (+30/-0)
ubuntu_ota_tests/hooks.py (+13/-3)
ubuntu_ota_tests/reactors.py (+5/-1)
To merge this branch: bzr merge lp:~barry/ubuntu-ota-tests/packaging
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-03-19
Christopher Lee (community) 2015-03-18 Approve on 2015-03-19
Leo Arias (community) 2015-03-18 Approve on 2015-03-18
Review via email: mp+253357@code.launchpad.net

Commit Message

Packaged ubuntu-ota-tests.

Description of the Change

This refactors the test support code into a normal Debian native package, so that it can be depended on and re-used by other packages.

Note that currently there's a dependency on python3-autopilot, which pulls in a ton of stuff, but I think we talked about getting rid of that dependency. I'll leave that for another branch.

This also adds some code so that it should work with either system-image 2.5 or 3.0. When the latter lands in vivid, we should remove or deprecate the 2.5 support.

To post a comment you must log in.
Leo Arias (elopio) wrote :

This is great. We just need to remove the cd debian/tests from the tests, and then we will be able to run the tests with -B --unbuilt-tree.

After fixing that, consider this my approval.

Thanks barry.

Barry Warsaw (barry) wrote :

Fixed! Thanks.

Barry Warsaw (barry) wrote :

Oops, conflicts with trunk. I'll fix those.

Leo Arias (elopio) wrote :

Sorry, I left my approval in the wrong place.

review: Approve
Christopher Lee (veebers) wrote :

I think the readme should say '-B --unbuilt-tree=.' without the -B the build on the device fails for me if the archives are out of date (i.e. need to apt-get update on the device).

Other than that this is looking good. If my complaint above can be addressed (either by clarifying and it stays that way or it changes) then this is an approve from me.

review: Needs Information
Christopher Lee (veebers) wrote :

LGTM, readme can be fixed later.

review: Approve
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~barry/ubuntu-ota-tests/packaging/+merge/253357/+edit-commit-message

review: Needs Fixing (continuous-integration)
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2015-03-18 19:58:13 +0000
4@@ -0,0 +1,2 @@
5+ubuntu_ota_tests.egg-info
6+dist
7
8=== modified file 'README.rst'
9--- README.rst 2015-03-11 16:31:35 +0000
10+++ README.rst 2015-03-18 19:58:13 +0000
11@@ -2,6 +2,6 @@
12
13 The included example test can be run like so::
14
15- adt-run -B --unbuilt-tree=. --- ssh -s adb
16+ adt-run --unbuilt-tree=. --- ssh -s adb
17
18 All this example does is run and exits 0.
19
20=== modified file 'debian/changelog'
21--- debian/changelog 2015-03-03 01:59:45 +0000
22+++ debian/changelog 2015-03-18 19:58:13 +0000
23@@ -1,4 +1,4 @@
24-ubuntu-ota-tests (1.0-1) UNRELEASED; urgency=medium
25+ubuntu-ota-tests (1.0) UNRELEASED; urgency=medium
26
27 * Initial release.
28
29
30=== added file 'debian/compat'
31--- debian/compat 1970-01-01 00:00:00 +0000
32+++ debian/compat 2015-03-18 19:58:13 +0000
33@@ -0,0 +1,1 @@
34+9
35
36=== modified file 'debian/control'
37--- debian/control 2015-03-08 17:34:00 +0000
38+++ debian/control 2015-03-18 19:58:13 +0000
39@@ -1,1 +1,24 @@
40+Source: ubuntu-ota-tests
41+Maintainer: QA Team <qa-team@lists.canonical.com>
42 Homepage: http://launchpad.net/ubuntu-ota-tests
43+Section: python
44+X-Python3-Version: >= 3.4
45+Priority: optional
46+Build-Depends: debhelper (>= 9),
47+ dh-python,
48+ python3-all (>= 3.3),
49+ python3-setuptools
50+Standards-Version: 3.9.6
51+XS-Testsuite: autopkgtest
52+Vcs-Bzr: https://code.launchpad.net/~canonical-platform-qa/ubuntu-ota-tests/trunk
53+Vcs-Browser: http://bazaar.launchpad.net/~canonical-platform-qa/ubuntu-ota-tests/trunk/files
54+
55+Package: python3-ubuntu-ota-tests
56+Architecture: all
57+Depends: python3-autopilot,
58+ system-image-common,
59+ ${misc:Depends},
60+ ${python3:Depends}
61+Description: support for OTA tests
62+ This package provides a Python 3 library that can be used as a DEP-8
63+ dependency for testing OTA upgrades.
64
65=== added file 'debian/rules'
66--- debian/rules 1970-01-01 00:00:00 +0000
67+++ debian/rules 2015-03-18 19:58:13 +0000
68@@ -0,0 +1,11 @@
69+#!/usr/bin/make -f
70+
71+DH_VERBOSE=1
72+#DEB_BUILD_OPTIONS=nocheck
73+
74+%:
75+ dh $@ --with python3 --buildsystem=pybuild
76+
77+# To avoid circular Build-Depends, do not run the package's test suite at
78+# build time. Instead, they will get run via DEP-8.
79+override_dh_auto_test:
80
81=== renamed file 'debian/tests/check_for_update' => 'debian/tests/check-for-update'
82=== modified file 'debian/tests/control'
83--- debian/tests/control 2015-03-17 15:28:51 +0000
84+++ debian/tests/control 2015-03-18 19:58:13 +0000
85@@ -1,17 +1,17 @@
86-Tests: ota_selftests
87+Tests: ota-selftests
88 Restrictions: allow-stderr
89 Depends: python3-autopilot,
90 python3-coverage,
91 python3-psutil,
92 system-image-dbus
93
94-Test-Command: cd debian/tests; python3 -m unittest ubuntu_ota_tests.tests.test_basic_upgrade
95+Test-Command: python3 -m unittest ubuntu_ota_tests.tests.test_basic_upgrade
96 Restrictions: needs-root allow-stderr
97 Depends: python3-autopilot,
98 python3-psutil,
99 system-image-cli
100
101-Tests: check_for_update
102+Tests: check-for-update
103 Depends: system-image-common,
104 system-image-dbus,
105 ubuntu-download-manager,
106
107=== renamed file 'debian/tests/ota_basic' => 'debian/tests/ota-basic'
108=== renamed file 'debian/tests/ota_selftests' => 'debian/tests/ota-selftests'
109--- debian/tests/ota_selftests 2015-03-16 14:24:25 +0000
110+++ debian/tests/ota-selftests 2015-03-18 19:58:13 +0000
111@@ -20,8 +20,6 @@
112
113 set -e
114
115-cd debian/tests
116-
117 python3-coverage run --include=./ubuntu_ota_tests/* --omit=./ubuntu_ota_tests/selftests/*,./ubuntu_ota_tests/__init__.py -m unittest discover -v ubuntu_ota_tests.selftests
118
119 mkdir -p $ADT_ARTIFACTS/coverage && python3-coverage report -m > $ADT_ARTIFACTS/coverage/report.txt
120
121=== added file 'setup.py'
122--- setup.py 1970-01-01 00:00:00 +0000
123+++ setup.py 2015-03-18 19:58:13 +0000
124@@ -0,0 +1,30 @@
125+#
126+# Ubuntu OTA Tests
127+# Copyright (C) 2015 Canonical
128+#
129+# This program is free software: you can redistribute it and/or modify
130+# it under the terms of the GNU General Public License as published by
131+# the Free Software Foundation, either version 3 of the License, or
132+# (at your option) any later version.
133+#
134+# This program is distributed in the hope that it will be useful,
135+# but WITHOUT ANY WARRANTY; without even the implied warranty of
136+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137+# GNU General Public License for more details.
138+#
139+# You should have received a copy of the GNU General Public License
140+# along with this program. If not, see <http://www.gnu.org/licenses/>.
141+#
142+
143+from setuptools import find_packages, setup
144+
145+setup(
146+ name='ubuntu-ota-tests',
147+ version='1.0',
148+ description='Ubuntu OTA tests',
149+ author='Ubuntu QA Team',
150+ author_email='qa-team@lists.canonical.com',
151+ license='GNU GPLv3',
152+ packages=find_packages(),
153+ include_package_data=True,
154+ )
155
156=== renamed directory 'debian/tests/ubuntu_ota_tests' => 'ubuntu_ota_tests'
157=== modified file 'ubuntu_ota_tests/hooks.py'
158--- debian/tests/ubuntu_ota_tests/hooks.py 2015-03-12 15:17:34 +0000
159+++ ubuntu_ota_tests/hooks.py 2015-03-18 19:58:13 +0000
160@@ -19,17 +19,24 @@
161 import logging
162 import subprocess
163
164-from systemimage import reboot
165+try:
166+ # si 3.0
167+ from systemimage.apply import BaseApply as Base
168+except ImportError:
169+ # si 2.5
170+ from systemimage.reboot import BaseReboot as Base
171+
172
173
174 log = logging.getLogger('systemimage')
175
176
177-class ADTRebootToRecovery(reboot.BaseReboot):
178+class ADTRebootToRecovery(Base):
179
180 """Hook to be used during system image upgrade to apply the upgrade."""
181
182- def reboot(self):
183+ # si 3.0
184+ def apply(self):
185 """Reboot the testbed to apply the upgrade.
186
187 This method does not execute the reboot, it tells adt-run that the
188@@ -54,6 +61,9 @@
189 log.exception('reboot command output: {}'.format(error.output))
190 raise
191
192+ # si 2.5
193+ reboot = apply
194+
195 def _set_adt_reboot_to_recovery_flag(self):
196 """Set a flag to tell adt that the reboot needs to go into recovery."""
197 with open('/run/adt_reboot_target', 'w') as reboot_target:
198
199=== modified file 'ubuntu_ota_tests/reactors.py'
200--- debian/tests/ubuntu_ota_tests/reactors.py 2015-03-17 11:52:35 +0000
201+++ ubuntu_ota_tests/reactors.py 2015-03-18 19:58:13 +0000
202@@ -35,6 +35,7 @@
203 'is_available downloading available_version update_size '
204 'last_update_date error_reason')
205 RebootingRecord = namedtuple('RebootingRecord', 'status')
206+AppliedRecord = namedtuple('AppliedRecord', 'status')
207 DownloadRecord = namedtuple(
208 'DownloadRecord', 'downloaded percentage paused failed')
209
210@@ -66,12 +67,15 @@
211
212 class ApplyUpdateReactor(BaseReactor):
213 def __init__(self, iface):
214- super().__init__(iface.ApplyUpdate, 'Rebooting')
215+ super().__init__(iface.ApplyUpdate, 'Applied', 'Rebooting')
216
217 def _do_Rebooting(self, signal, path, *args):
218 self.signals.append(RebootingRecord(*args))
219 self.quit()
220
221+ def _do_Applied(self, signal, path, *args):
222+ self.signals.append(AppliedRecord(*args))
223+
224
225 class DownloadReactor(BaseReactor):
226

Subscribers

People subscribed via source and target branches