Enable autopkgtesting on built arches when not all have been built yet

- autopkgtest now honors break_arches option
- incomplete testing is now treated with penalty behavior
ubuntu/rebased
Paul Gevers 7 years ago
parent 41c4729506
commit a16e4e5a55
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -1058,6 +1058,7 @@ class Britney(object):
if not packages: if not packages:
excuse.addhtml("%s/%s unsatisfiable Depends: %s" % (pkg, arch, block_txt.strip())) excuse.addhtml("%s/%s unsatisfiable Depends: %s" % (pkg, arch, block_txt.strip()))
excuse.addreason("depends") excuse.addreason("depends")
excuse.add_depends_breaks_arch(arch)
if arch not in self.options.break_arches: if arch not in self.options.break_arches:
is_all_ok = False is_all_ok = False
continue continue

@ -78,6 +78,7 @@ class Excuse(object):
self.deps = {} self.deps = {}
self.sane_deps = [] self.sane_deps = []
self.break_deps = [] self.break_deps = []
self.break_arch = []
self.bugs = [] self.bugs = []
self.newbugs = set() self.newbugs = set()
self.oldbugs = set() self.oldbugs = set()
@ -139,6 +140,11 @@ class Excuse(object):
if (name, arch) not in self.break_deps: if (name, arch) not in self.break_deps:
self.break_deps.append( (name, arch) ) self.break_deps.append( (name, arch) )
def add_depends_breaks_arch(self, arch):
"""Add an arch that breaks by dependency"""
if arch not in self.break_arch:
self.break_arch.append(arch)
def invalidate_dep(self, name): def invalidate_dep(self, name):
"""Invalidate dependency""" """Invalidate dependency"""
if name not in self.invalid_deps: self.invalid_deps.append(name) if name not in self.invalid_deps: self.invalid_deps.append(name)

@ -174,12 +174,17 @@ class AutopkgtestPolicy(BasePolicy):
os.rename(self.pending_tests_file + '.new', self.pending_tests_file) os.rename(self.pending_tests_file + '.new', self.pending_tests_file)
def apply_policy_impl(self, tests_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse): def apply_policy_impl(self, tests_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
# skip/delay autopkgtests until package is built # initialize
verdict = PolicyVerdict.PASS
src_has_own_test = False
# skip/delay autopkgtests until new package is built somewhere
binaries_info = self.britney.sources[suite][source_name] binaries_info = self.britney.sources[suite][source_name]
if excuse.missing_builds or not binaries_info.binaries or 'depends' in excuse.reason: if not binaries_info.binaries:
self.log('%s has missing builds or is uninstallable, skipping autopkgtest policy' % excuse.name) self.log('%s hasn''t been built anywhere, skipping autopkgtest policy' % excuse.name)
return PolicyVerdict.REJECTED_TEMPORARILY verdict = PolicyVerdict.REJECTED_TEMPORARILY
if verdict == PolicyVerdict.PASS:
self.log('Checking autopkgtests for %s' % source_name) self.log('Checking autopkgtests for %s' % source_name)
trigger = source_name + '/' + source_data_srcdist.version trigger = source_name + '/' + source_data_srcdist.version
@ -189,6 +194,13 @@ class AutopkgtestPolicy(BasePolicy):
# first # first
pkg_arch_result = {} pkg_arch_result = {}
for arch in self.adt_arches: for arch in self.adt_arches:
if arch in excuse.missing_builds:
verdict = PolicyVerdict.REJECTED_TEMPORARILY
self.log('%s hasn''t been built on arch %s, delay autopkgtest there' % (source_name, arch))
elif arch in excuse.break_arch:
verdict = PolicyVerdict.REJECTED_TEMPORARILY
self.log('%s is uninstallable on arch %s, delay autopkgtest there' % (source_name, arch))
else:
# request tests (unless they were already requested earlier or have a result) # request tests (unless they were already requested earlier or have a result)
tests = self.tests_for_source(source_name, source_data_srcdist.version, arch) tests = self.tests_for_source(source_name, source_data_srcdist.version, arch)
is_huge = False is_huge = False
@ -202,8 +214,6 @@ class AutopkgtestPolicy(BasePolicy):
pkg_arch_result.setdefault((testsrc, real_ver), {})[arch] = (result, url) pkg_arch_result.setdefault((testsrc, real_ver), {})[arch] = (result, url)
# add test result details to Excuse # add test result details to Excuse
verdict = PolicyVerdict.PASS
src_has_own_test = False
cloud_url = self.options.adt_ci_url + "packages/%(h)s/%(s)s/%(r)s/%(a)s" cloud_url = self.options.adt_ci_url + "packages/%(h)s/%(s)s/%(r)s/%(a)s"
for (testsrc, testver) in sorted(pkg_arch_result): for (testsrc, testver) in sorted(pkg_arch_result):
arch_results = pkg_arch_result[(testsrc, testver)] arch_results = pkg_arch_result[(testsrc, testver)]
@ -279,10 +289,10 @@ class AutopkgtestPolicy(BasePolicy):
if self.options.adt_success_bounty and verdict == PolicyVerdict.PASS and src_has_own_test: if self.options.adt_success_bounty and verdict == PolicyVerdict.PASS and src_has_own_test:
excuse.add_bounty('autopkgtest', int(self.options.adt_success_bounty)) excuse.add_bounty('autopkgtest', int(self.options.adt_success_bounty))
if self.options.adt_regression_penalty and verdict == PolicyVerdict.REJECTED_PERMANENTLY: if self.options.adt_regression_penalty and \
verdict in [PolicyVerdict.REJECTED_PERMANENTLY, PolicyVerdict.REJECTED_TEMPORARILY]:
excuse.add_penalty('autopkgtest', int(self.options.adt_regression_penalty)) excuse.add_penalty('autopkgtest', int(self.options.adt_regression_penalty))
# In case we give penalties instead of blocking, we must pass in # In case we give penalties instead of blocking, we must always pass
# case of regression.
verdict = PolicyVerdict.PASS verdict = PolicyVerdict.PASS
return verdict return verdict

@ -705,7 +705,7 @@ class T(TestBase):
self.assertEqual(self.pending_requests, {}) self.assertEqual(self.pending_requests, {})
def test_partial_unbuilt(self): def test_partial_unbuilt(self):
'''Unbuilt package on some arches should not trigger tests''' '''Unbuilt package on some arches should not trigger tests on those arches'''
self.data.add_default_packages(green=False) self.data.add_default_packages(green=False)
@ -715,6 +715,12 @@ class T(TestBase):
'Conflicts': 'blue'}, 'Conflicts': 'blue'},
testsuite='autopkgtest', add_src=False) testsuite='autopkgtest', add_src=False)
self.swift.set_results({'autopkgtest-testing': {
'testing/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1', tr('green/2')),
'testing/i386/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/2')),
'testing/i386/g/green/20150101_100200@': (0, 'green 2', tr('green/2')),
}})
exc = self.do_test( exc = self.do_test(
[], [],
{'green': (False, {})}, {'green': (False, {})},
@ -723,13 +729,13 @@ class T(TestBase):
'on-unimportant-architectures': []}) 'on-unimportant-architectures': []})
] ]
})[1] })[1]
# autopkgtest should not be triggered for unbuilt pkg # autopkgtest should not be triggered on arches with unbuilt pkg
self.assertEqual(exc['green']['policy_info']['autopkgtest'], {'verdict': 'REJECTED_TEMPORARILY'}) self.assertEqual(exc['green']['policy_info']['autopkgtest']['verdict'], 'REJECTED_TEMPORARILY')
self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.amqp_requests, set())
self.assertEqual(self.pending_requests, {}) self.assertEqual(self.pending_requests, {})
def test_partial_unbuilt_block(self): def test_partial_unbuilt_block(self):
'''Unbuilt blocked package on some arches should not trigger tests''' '''Unbuilt blocked package on some arches should not trigger tests on those arches'''
self.data.add_default_packages(green=False) self.data.add_default_packages(green=False)
@ -741,6 +747,12 @@ class T(TestBase):
'Conflicts': 'blue'}, 'Conflicts': 'blue'},
testsuite='autopkgtest', add_src=False) testsuite='autopkgtest', add_src=False)
self.swift.set_results({'autopkgtest-testing': {
'testing/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1', tr('green/2')),
'testing/i386/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/2')),
'testing/i386/g/green/20150101_100200@': (0, 'green 2', tr('green/2')),
}})
exc = self.do_test( exc = self.do_test(
[], [],
{'green': (False, {})}, {'green': (False, {})},
@ -749,8 +761,8 @@ class T(TestBase):
'on-unimportant-architectures': []}) 'on-unimportant-architectures': []})
] ]
})[1] })[1]
# autopkgtest should not be triggered for unbuilt pkg # autopkgtest should not be triggered on arches with unbuilt pkg
self.assertEqual(exc['green']['policy_info']['autopkgtest'], {'verdict': 'REJECTED_TEMPORARILY'}) self.assertEqual(exc['green']['policy_info']['autopkgtest']['verdict'], 'REJECTED_TEMPORARILY')
self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.amqp_requests, set())
self.assertEqual(self.pending_requests, {}) self.assertEqual(self.pending_requests, {})
@ -2490,8 +2502,8 @@ class T(TestBase):
}, },
{'green': [('old-version', '1'), ('new-version', '2')]})[1] {'green': [('old-version', '1'), ('new-version', '2')]})[1]
# while no autopkgtest results are known, default age applies # while no autopkgtest results are known, penalty applies
self.assertEqual(exc['green']['policy_info']['age']['age-requirement'], 13) self.assertEqual(exc['green']['policy_info']['age']['age-requirement'], 40)
# second run collects the results # second run collects the results
self.swift.set_results({'autopkgtest-testing': { self.swift.set_results({'autopkgtest-testing': {

Loading…
Cancel
Save