From 0329fb28e266c42c8675ca9e53346e7272a5b8bf Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Thu, 16 Apr 2020 13:09:42 +0100 Subject: [PATCH] autopkgtest: When we're missing builds on non-adt arches only, go ahead and run the tests Again the rest of britney will take care of invalidating the excuse if it needs to. --- britney2/policies/autopkgtest.py | 3 +- tests/test_autopkgtest.py | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index 96908d2..2741cfb 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -177,12 +177,13 @@ class AutopkgtestPolicy(BasePolicy): binaries_info = self.britney.sources[suite][source_name] unsat_deps = excuse.unsat_deps.copy() non_adt_arches = set(self.options.architectures) - set(self.adt_arches) + interesting_missing_builds = set(excuse.missing_builds) - non_adt_arches for arch in set(self.options.break_arches) | non_adt_arches: try: del unsat_deps[arch] except KeyError: pass - if excuse.missing_builds or not binaries_info.binaries or unsat_deps: + if interesting_missing_builds or not binaries_info.binaries or unsat_deps: self.log('%s has missing builds or is uninstallable, skipping autopkgtest policy' % excuse.name) return PolicyVerdict.REJECTED_TEMPORARILY diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 51e2084..2ca4a4f 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -311,6 +311,60 @@ class T(TestBase): self.assertNotIn('accepted: pink', upgrade_out) self.assertIn('SUCCESS (0/0)', upgrade_out) + def test_tests_requested_when_non_adt_arch_is_missing_build(self): + ''' When a package is unbuilt on an arch that isn't an ADT_ARCH, + we should still request tests (but the package should remain a + non-candidate unless it is in BREAK_ARCHES - see above test). ''' + self.sourceppa_cache['pink'] = {'2': ''} + self.swift.set_results({'autopkgtest-series': { + 'series/amd64/p/pink/20150101_100000@': (0, 'pink 1', tr('pink/1')), + 'series/ppc64el/p/pink/20150101_100000@': (0, 'pink 1', tr('pink/1')) + }}) + + self.data.add('pink', + False, + {'Version': '1', + 'Depends': 'libc6 (>= 0.9)', + 'Architecture': 'amd64'}, + testsuite='autopkgtest') + self.data.add('pink', + False, + {'Version': '1', + 'Depends': 'libc6 (>= 0.9)', + 'Architecture': 'ppc64el'}, + testsuite='autopkgtest') + # built in unstable on amd64 only, so ppc64el is missing-build + self.data.add('pink', + True, + {'Version': '2', + 'Depends': 'libc6 (>= 0.9)', + 'Architecture': 'amd64'}, + testsuite='autopkgtest') + exc = self.do_test( + [], + {'pink': (False, {})} + )[1] + + # we noticed the unsat dep + self.assertEqual(exc['pink']['missing-builds']['on-architectures'], + ['ppc64el']) + + # but still requested the tests + self.assertEqual(self.pending_requests, {'pink/2': {'pink': ['amd64']}}) + self.assertEqual(self.amqp_requests, set(['debci-series-amd64:pink {"triggers": ["pink/2"]}'])) + self.assertEqual(exc['pink']['policy_info']['autopkgtest'], + {'pink': {'amd64': ['RUNNING', + 'http://autopkgtest.ubuntu.com/running', + 'http://autopkgtest.ubuntu.com/packages/p/pink/series/amd64', + None, + None]}}) + + + with open(os.path.join(self.data.path, 'output', 'series', 'output.txt')) as f: + upgrade_out = f.read() + self.assertNotIn('accepted: pink', upgrade_out) + self.assertIn('SUCCESS (0/0)', upgrade_out) + def test_no_request_for_excluded_arch(self): ''' Does not request a test on an architecture for which the package