Merge ~ubuntu-release/britney/+git/britney2-ubuntu:wip/autopkgtest-dont-block-risc-and-run-tests-when-we-can into ~ubuntu-release/britney/+git/britney2-ubuntu:master
- Git
- lp:~ubuntu-release/britney/+git/britney2-ubuntu
- wip/autopkgtest-dont-block-risc-and-run-tests-when-we-can
- Merge into master
Proposed by
Iain Lane
Status: | Merged |
---|---|
Merged at revision: | 0329fb28e266c42c8675ca9e53346e7272a5b8bf |
Proposed branch: | ~ubuntu-release/britney/+git/britney2-ubuntu:wip/autopkgtest-dont-block-risc-and-run-tests-when-we-can |
Merge into: | ~ubuntu-release/britney/+git/britney2-ubuntu:master |
Diff against target: |
300 lines (+176/-14) 4 files modified
britney.conf (+3/-3) britney2/policies/autopkgtest.py (+9/-1) tests/__init__.py (+15/-6) tests/test_autopkgtest.py (+149/-4) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Łukasz Zemczak | Approve | ||
Review via email: mp+382422@code.launchpad.net |
Commit message
Various related changes to fix issues now we have an arch which is sadly not being tested
- Don't block migration items when only non-adt arches are bad
- Run tests when every adt arch is ready for them to be run
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/britney.conf b/britney.conf |
2 | index 09563b7..5daa041 100644 |
3 | --- a/britney.conf |
4 | +++ b/britney.conf |
5 | @@ -29,7 +29,7 @@ STATE_DIR = data/%(SERIES)/state |
6 | # List of architectures that Britney should consider. |
7 | # - defaults to the value in testing's Release file (if it is present). |
8 | # - Required for the legacy layout. |
9 | -ARCHITECTURES = amd64 arm64 armhf i386 powerpc ppc64el |
10 | +ARCHITECTURES = amd64 arm64 armhf i386 powerpc ppc64el riscv64 |
11 | |
12 | # if you're not in this list, arch: all packages are allowed to break on you |
13 | NOBREAKALL_ARCHES = amd64 |
14 | @@ -38,10 +38,10 @@ NOBREAKALL_ARCHES = amd64 |
15 | OUTOFSYNC_ARCHES = |
16 | |
17 | # if you're in this list, your uninstallability count may increase |
18 | -BREAK_ARCHES = |
19 | +BREAK_ARCHES = riscv64 |
20 | |
21 | # if you're in this list, you are a new architecture |
22 | -NEW_ARCHES = |
23 | +NEW_ARCHES = riscv64 |
24 | |
25 | # priorities and delays |
26 | MINDAYS_LOW = 0 |
27 | diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py |
28 | index 1a93691..2741cfb 100644 |
29 | --- a/britney2/policies/autopkgtest.py |
30 | +++ b/britney2/policies/autopkgtest.py |
31 | @@ -175,7 +175,15 @@ class AutopkgtestPolicy(BasePolicy): |
32 | def apply_policy_impl(self, tests_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse): |
33 | # skip/delay autopkgtests until package is built |
34 | binaries_info = self.britney.sources[suite][source_name] |
35 | - if excuse.missing_builds or not binaries_info.binaries or 'depends' in excuse.reason: |
36 | + unsat_deps = excuse.unsat_deps.copy() |
37 | + non_adt_arches = set(self.options.architectures) - set(self.adt_arches) |
38 | + interesting_missing_builds = set(excuse.missing_builds) - non_adt_arches |
39 | + for arch in set(self.options.break_arches) | non_adt_arches: |
40 | + try: |
41 | + del unsat_deps[arch] |
42 | + except KeyError: |
43 | + pass |
44 | + if interesting_missing_builds or not binaries_info.binaries or unsat_deps: |
45 | self.log('%s has missing builds or is uninstallable, skipping autopkgtest policy' % excuse.name) |
46 | return PolicyVerdict.REJECTED_TEMPORARILY |
47 | |
48 | diff --git a/tests/__init__.py b/tests/__init__.py |
49 | index e08edc3..f28e510 100644 |
50 | --- a/tests/__init__.py |
51 | +++ b/tests/__init__.py |
52 | @@ -13,7 +13,7 @@ import unittest |
53 | |
54 | PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
55 | |
56 | -architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'] |
57 | +architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el', 'riscv64'] |
58 | |
59 | |
60 | class TestData: |
61 | @@ -37,7 +37,9 @@ class TestData: |
62 | os.makedirs(self.dirs[False]) |
63 | os.mkdir(self.dirs[True]) |
64 | self.added_sources = {False: set(), True: set()} |
65 | - self.added_binaries = {False: set(), True: set()} |
66 | + self.added_binaries = {} |
67 | + for arch in architectures: |
68 | + self.added_binaries[arch] = {False: set(), True: set()} |
69 | |
70 | # pre-create all files for all architectures |
71 | for arch in architectures: |
72 | @@ -75,10 +77,16 @@ class TestData: |
73 | source record, based on fields['Source'] and name. In that case, the |
74 | "Testsuite:" field is set to the testsuite argument. |
75 | ''' |
76 | - assert (name not in self.added_binaries[unstable]) |
77 | - self.added_binaries[unstable].add(name) |
78 | - |
79 | fields.setdefault('Architecture', 'all') |
80 | + if fields['Architecture'] == 'all': |
81 | + arches = architectures |
82 | + else: |
83 | + arches = [fields['Architecture']] |
84 | + |
85 | + for a in arches: |
86 | + assert (name not in self.added_binaries[a][unstable]) |
87 | + self.added_binaries[a][unstable].add(name) |
88 | + |
89 | fields.setdefault('Version', '1') |
90 | fields.setdefault('Priority', 'optional') |
91 | fields.setdefault('Section', 'devel') |
92 | @@ -130,7 +138,8 @@ Maintainer: Joe <joe@example.com> |
93 | def remove_all(self, unstable): |
94 | '''Remove all added packages''' |
95 | |
96 | - self.added_binaries[unstable] = set() |
97 | + for arch in self.added_binaries: |
98 | + self.added_binaries[arch][unstable] = set() |
99 | self.added_sources[unstable] = set() |
100 | for a in architectures: |
101 | open(os.path.join(self.dirs[unstable], 'Packages_' + a), 'w').close() |
102 | diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py |
103 | index e4c2b49..2ca4a4f 100755 |
104 | --- a/tests/test_autopkgtest.py |
105 | +++ b/tests/test_autopkgtest.py |
106 | @@ -29,7 +29,7 @@ apt_pkg.init() |
107 | def tr(s): |
108 | return {'custom_environment': ['ADT_TEST_TRIGGERS=%s' % s]} |
109 | |
110 | -ON_ALL_ARCHES = {'on-architectures': ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'], |
111 | +ON_ALL_ARCHES = {'on-architectures': ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el', 'riscv64'], |
112 | 'on-unimportant-architectures': []} |
113 | |
114 | |
115 | @@ -52,6 +52,8 @@ class T(TestBase): |
116 | print('ADT_SWIFT_URL = http://localhost:18085') |
117 | elif 'ADT_ARCHES' in line: |
118 | print('ADT_ARCHES = amd64 i386') |
119 | + elif 'BREAK_ARCHES' in line: |
120 | + print('BREAK_ARCHES = riscv64') |
121 | else: |
122 | sys.stdout.write(line) |
123 | |
124 | @@ -220,6 +222,149 @@ class T(TestBase): |
125 | self.assertNotIn('accepted:', upgrade_out) |
126 | self.assertIn('SUCCESS (0/0)', upgrade_out) |
127 | |
128 | + def test_no_request_for_uninstallable_break_arch_not_adt_arch(self): |
129 | + '''Does not request a test for an uninstallable package if |
130 | + uninstallable on a BREAK_ARCH which isn't in ADT_ARCHES, package |
131 | + becomes a candidate''' |
132 | + |
133 | + self.sourceppa_cache['pink'] = {'1': ''} |
134 | + self.swift.set_results({'autopkgtest-series': { |
135 | + 'series/riscv64/p/pink/20150101_100000@': (0, 'pink 0.1', tr('pink/0.1')) |
136 | + }}) |
137 | + |
138 | + self.data.add_src('pink', True, {'Version': '1', 'Testsuite': 'autopkgtest'}) |
139 | + self.data.add('pink', |
140 | + True, |
141 | + {'Version': '1', |
142 | + 'Depends': 'libc6 (>= 0.9), libgreen1 (>= 2)', |
143 | + 'Architecture': 'riscv64'}, |
144 | + testsuite='autopkgtest', |
145 | + add_src=False) |
146 | + exc = self.do_test( |
147 | + # uninstallable unstable version on riscv64 (BREAK_ARCH) only |
148 | + [], |
149 | + {'pink': (True, {})} |
150 | + )[1] |
151 | + |
152 | + # autopkgtest should not be triggered since riscv64 is not in ADT_ARCHES |
153 | + self.assertEqual(exc['pink']['policy_info']['autopkgtest'], {}) |
154 | + # we noticed the unsat dep |
155 | + self.assertEqual(exc['pink']['dependencies']['unsatisfiable-dependencies'], |
156 | + {'riscv64': ['libgreen1 (>= 2)']}) |
157 | + |
158 | + self.assertEqual(self.pending_requests, {}) |
159 | + self.assertEqual(self.amqp_requests, set()) |
160 | + |
161 | + with open(os.path.join(self.data.path, 'output', 'series', 'output.txt')) as f: |
162 | + upgrade_out = f.read() |
163 | + self.assertIn('accepted: pink', upgrade_out) |
164 | + self.assertIn('SUCCESS (1/0)', upgrade_out) |
165 | + |
166 | + def test_tests_requested_when_non_adt_arch_is_blocking(self): |
167 | + ''' When a package is uninstallable on an arch that isn't an ADT_ARCH, |
168 | + we should still request tests (but the package should remain a |
169 | + non-candidate unless it is in BREAK_ARCHES - see above test). ''' |
170 | + self.sourceppa_cache['pink'] = {'1': ''} |
171 | + self.swift.set_results({'autopkgtest-series': { |
172 | + 'series/amd64/p/pink/20150101_100000@': (0, 'pink 0.1', tr('pink/0.1')), |
173 | + }}) |
174 | + |
175 | + self.data.add_src('pink', True, {'Version': '1', 'Testsuite': 'autopkgtest'}) |
176 | + # amd64 is installable |
177 | + self.data.add('pink', |
178 | + True, |
179 | + {'Version': '1', |
180 | + 'Depends': 'libc6 (>= 0.9)', |
181 | + 'Architecture': 'amd64'}, |
182 | + testsuite='autopkgtest', |
183 | + add_src=False) |
184 | + # ppc64el is not installable |
185 | + self.data.add('pink', |
186 | + True, |
187 | + {'Version': '1', |
188 | + 'Depends': 'libc6 (>= 0.9), libgreen1 (>= 2)', |
189 | + 'Architecture': 'ppc64el'}, |
190 | + testsuite='autopkgtest', |
191 | + add_src=False) |
192 | + exc = self.do_test( |
193 | + [], |
194 | + {'pink': (False, {})} |
195 | + )[1] |
196 | + |
197 | + # we noticed the unsat dep |
198 | + self.assertEqual(exc['pink']['dependencies']['unsatisfiable-dependencies'], |
199 | + {'ppc64el': ['libgreen1 (>= 2)']}) |
200 | + |
201 | + # but still requested the tests |
202 | + self.assertEqual(self.pending_requests, {'pink/1': {'pink': ['amd64']}}) |
203 | + self.assertEqual(self.amqp_requests, set(['debci-series-amd64:pink {"triggers": ["pink/1"]}'])) |
204 | + self.assertEqual(exc['pink']['policy_info']['autopkgtest'], |
205 | + {'pink': {'amd64': ['RUNNING', |
206 | + 'http://autopkgtest.ubuntu.com/running', |
207 | + 'http://autopkgtest.ubuntu.com/packages/p/pink/series/amd64', |
208 | + None, |
209 | + None]}}) |
210 | + |
211 | + |
212 | + with open(os.path.join(self.data.path, 'output', 'series', 'output.txt')) as f: |
213 | + upgrade_out = f.read() |
214 | + self.assertNotIn('accepted: pink', upgrade_out) |
215 | + self.assertIn('SUCCESS (0/0)', upgrade_out) |
216 | + |
217 | + def test_tests_requested_when_non_adt_arch_is_missing_build(self): |
218 | + ''' When a package is unbuilt on an arch that isn't an ADT_ARCH, |
219 | + we should still request tests (but the package should remain a |
220 | + non-candidate unless it is in BREAK_ARCHES - see above test). ''' |
221 | + self.sourceppa_cache['pink'] = {'2': ''} |
222 | + self.swift.set_results({'autopkgtest-series': { |
223 | + 'series/amd64/p/pink/20150101_100000@': (0, 'pink 1', tr('pink/1')), |
224 | + 'series/ppc64el/p/pink/20150101_100000@': (0, 'pink 1', tr('pink/1')) |
225 | + }}) |
226 | + |
227 | + self.data.add('pink', |
228 | + False, |
229 | + {'Version': '1', |
230 | + 'Depends': 'libc6 (>= 0.9)', |
231 | + 'Architecture': 'amd64'}, |
232 | + testsuite='autopkgtest') |
233 | + self.data.add('pink', |
234 | + False, |
235 | + {'Version': '1', |
236 | + 'Depends': 'libc6 (>= 0.9)', |
237 | + 'Architecture': 'ppc64el'}, |
238 | + testsuite='autopkgtest') |
239 | + # built in unstable on amd64 only, so ppc64el is missing-build |
240 | + self.data.add('pink', |
241 | + True, |
242 | + {'Version': '2', |
243 | + 'Depends': 'libc6 (>= 0.9)', |
244 | + 'Architecture': 'amd64'}, |
245 | + testsuite='autopkgtest') |
246 | + exc = self.do_test( |
247 | + [], |
248 | + {'pink': (False, {})} |
249 | + )[1] |
250 | + |
251 | + # we noticed the unsat dep |
252 | + self.assertEqual(exc['pink']['missing-builds']['on-architectures'], |
253 | + ['ppc64el']) |
254 | + |
255 | + # but still requested the tests |
256 | + self.assertEqual(self.pending_requests, {'pink/2': {'pink': ['amd64']}}) |
257 | + self.assertEqual(self.amqp_requests, set(['debci-series-amd64:pink {"triggers": ["pink/2"]}'])) |
258 | + self.assertEqual(exc['pink']['policy_info']['autopkgtest'], |
259 | + {'pink': {'amd64': ['RUNNING', |
260 | + 'http://autopkgtest.ubuntu.com/running', |
261 | + 'http://autopkgtest.ubuntu.com/packages/p/pink/series/amd64', |
262 | + None, |
263 | + None]}}) |
264 | + |
265 | + |
266 | + with open(os.path.join(self.data.path, 'output', 'series', 'output.txt')) as f: |
267 | + upgrade_out = f.read() |
268 | + self.assertNotIn('accepted: pink', upgrade_out) |
269 | + self.assertIn('SUCCESS (0/0)', upgrade_out) |
270 | + |
271 | def test_no_request_for_excluded_arch(self): |
272 | ''' |
273 | Does not request a test on an architecture for which the package |
274 | @@ -737,7 +882,7 @@ class T(TestBase): |
275 | [], |
276 | {'green': (False, {})}, |
277 | {'green': [('old-version', '1'), ('new-version', '2'), |
278 | - ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], |
279 | + ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], |
280 | 'on-unimportant-architectures': []}) |
281 | ] |
282 | })[1] |
283 | @@ -757,7 +902,7 @@ class T(TestBase): |
284 | [], |
285 | {'green': (False, {})}, |
286 | {'green': [('old-version', '1'), ('new-version', '2'), |
287 | - ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], |
288 | + ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], |
289 | 'on-unimportant-architectures': []}) |
290 | ] |
291 | })[1] |
292 | @@ -2488,7 +2633,7 @@ class T(TestBase): |
293 | exc = self.do_test( |
294 | [('red', {'Version': '2'}, 'autopkgtest')], |
295 | {'green': (False, {}), 'red': (False, {})}, |
296 | - {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], |
297 | + {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], |
298 | 'on-unimportant-architectures': []})], |
299 | 'red': [('reason', 'source-ppa')]} |
300 | )[1] |
Ok, this makes sense. The test cases also seem to cover the new cases. I included some nitpick stylistic things (in comments, so screw those!), but otherwise this looks good.