diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index 1a93691..83f3b07 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -175,7 +175,13 @@ class AutopkgtestPolicy(BasePolicy): def apply_policy_impl(self, tests_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse): # skip/delay autopkgtests until package is built binaries_info = self.britney.sources[suite][source_name] - if excuse.missing_builds or not binaries_info.binaries or 'depends' in excuse.reason: + unsat_deps = excuse.unsat_deps.copy() + for arch in self.options.break_arches: + try: + del unsat_deps[arch] + except KeyError: + pass + if excuse.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/__init__.py b/tests/__init__.py index e08edc3..aa5bd7b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -13,7 +13,7 @@ import unittest PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'] +architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el', 'riscv64'] class TestData: diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index e4c2b49..07ff861 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -29,7 +29,7 @@ apt_pkg.init() def tr(s): return {'custom_environment': ['ADT_TEST_TRIGGERS=%s' % s]} -ON_ALL_ARCHES = {'on-architectures': ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'], +ON_ALL_ARCHES = {'on-architectures': ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el', 'riscv64'], 'on-unimportant-architectures': []} @@ -52,6 +52,8 @@ class T(TestBase): print('ADT_SWIFT_URL = http://localhost:18085') elif 'ADT_ARCHES' in line: print('ADT_ARCHES = amd64 i386') + elif 'BREAK_ARCHES' in line: + print('BREAK_ARCHES = riscv64') else: sys.stdout.write(line) @@ -220,6 +222,44 @@ class T(TestBase): self.assertNotIn('accepted:', upgrade_out) self.assertIn('SUCCESS (0/0)', upgrade_out) + def test_no_request_for_uninstallable_break_arch_not_adt_arch(self): + '''Does not request a test for an uninstallable package if + uninstallable on a BREAK_ARCH which isn't in ADT_ARCHES, package + becomes a candidate''' + + self.sourceppa_cache['pink'] = {'1': ''} + self.swift.set_results({'autopkgtest-series': { + 'series/riscv64/p/pink/20150101_100000@': (0, 'pink 0.1', tr('pink/0.1')) + }}) + + self.data.add_src('pink', True, {'Version': '1', 'Testsuite': 'autopkgtest'}) + self.data.add('pink', + True, + {'Version': '1', + 'Depends': 'libc6 (>= 0.9), libgreen1 (>= 2)', + 'Architecture': 'riscv64'}, + testsuite='autopkgtest', + add_src=False) + exc = self.do_test( + # uninstallable unstable version on riscv64 (BREAK_ARCH) only + [], + {'pink': (True, {})} + )[1] + + # autopkgtest should not be triggered since riscv64 is not in ADT_ARCHES + self.assertEqual(exc['pink']['policy_info']['autopkgtest'], {}) + # we noticed the unsat dep + self.assertEqual(exc['pink']['dependencies']['unsatisfiable-dependencies'], + {'riscv64': ['libgreen1 (>= 2)']}) + + self.assertEqual(self.pending_requests, {}) + self.assertEqual(self.amqp_requests, set()) + + with open(os.path.join(self.data.path, 'output', 'series', 'output.txt')) as f: + upgrade_out = f.read() + self.assertIn('accepted: pink', upgrade_out) + self.assertIn('SUCCESS (1/0)', upgrade_out) + def test_no_request_for_excluded_arch(self): ''' Does not request a test on an architecture for which the package @@ -737,7 +777,7 @@ class T(TestBase): [], {'green': (False, {})}, {'green': [('old-version', '1'), ('new-version', '2'), - ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], + ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], 'on-unimportant-architectures': []}) ] })[1] @@ -757,7 +797,7 @@ class T(TestBase): [], {'green': (False, {})}, {'green': [('old-version', '1'), ('new-version', '2'), - ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], + ('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], 'on-unimportant-architectures': []}) ] })[1] @@ -2488,7 +2528,7 @@ class T(TestBase): exc = self.do_test( [('red', {'Version': '2'}, 'autopkgtest')], {'green': (False, {}), 'red': (False, {})}, - {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'], + {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el', 'riscv64'], 'on-unimportant-architectures': []})], 'red': [('reason', 'source-ppa')]} )[1]