Don't run autopkgtest on architectures where the triggering package doesn't exist

ubuntu/rebased
Paul Gevers 5 years ago
parent 64ba19cde4
commit 56babea058
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -366,7 +366,7 @@ class AutopkgtestPolicy(BasePolicy):
self.logger.info('%s is uninstallable on arch %s, not running autopkgtest there', source_name, arch) self.logger.info('%s is uninstallable on arch %s, not running autopkgtest there', source_name, arch)
excuse.addinfo("uninstallable on arch %s, not running autopkgtest there" % arch) excuse.addinfo("uninstallable on arch %s, not running autopkgtest there" % arch)
else: else:
self.request_tests_for_source(item, arch, source_data_srcdist, pkg_arch_result) self.request_tests_for_source(item, arch, source_data_srcdist, pkg_arch_result, excuse)
# add test result details to Excuse # add test result details to Excuse
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"
@ -479,7 +479,7 @@ class AutopkgtestPolicy(BasePolicy):
return False return False
def request_tests_for_source(self, item, arch, source_data_srcdist, pkg_arch_result): def request_tests_for_source(self, item, arch, source_data_srcdist, pkg_arch_result, excuse):
pkg_universe = self.britney.pkg_universe pkg_universe = self.britney.pkg_universe
target_suite = self.suite_info.target_suite target_suite = self.suite_info.target_suite
source_suite = item.suite source_suite = item.suite
@ -488,7 +488,7 @@ class AutopkgtestPolicy(BasePolicy):
source_name = item.package source_name = item.package
source_version = source_data_srcdist.version source_version = source_data_srcdist.version
# 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_version, arch) tests = self.tests_for_source(source_name, source_version, arch, excuse)
is_huge = False is_huge = False
try: try:
is_huge = len(tests) > int(self.options.adt_huge) is_huge = len(tests) > int(self.options.adt_huge)
@ -598,7 +598,7 @@ class AutopkgtestPolicy(BasePolicy):
(result, real_ver, run_id, url) = self.pkg_test_result(testsrc, testver, arch, trigger) (result, real_ver, run_id, url) = self.pkg_test_result(testsrc, testver, arch, trigger)
pkg_arch_result[(testsrc, real_ver)][arch] = (result, run_id, url) pkg_arch_result[(testsrc, real_ver)][arch] = (result, run_id, url)
def tests_for_source(self, src, ver, arch): def tests_for_source(self, src, ver, arch, excuse):
'''Iterate over all tests that should be run for given source and arch''' '''Iterate over all tests that should be run for given source and arch'''
source_suite = self.suite_info.primary_source_suite source_suite = self.suite_info.primary_source_suite
@ -642,8 +642,10 @@ class AutopkgtestPolicy(BasePolicy):
return [] return []
# we want to test the package itself, if it still has a test in unstable # we want to test the package itself, if it still has a test in unstable
# but only if the package actually exists on this arch
srcinfo = source_suite.sources[src] srcinfo = source_suite.sources[src]
if 'autopkgtest' in srcinfo.testsuite or self.has_autodep8(srcinfo): if ('autopkgtest' in srcinfo.testsuite or self.has_autodep8(srcinfo)) and \
len(excuse.packages[arch]) > 0:
reported_pkgs.add(src) reported_pkgs.add(src)
tests.append((src, ver)) tests.append((src, ver))

@ -68,8 +68,11 @@ def initialize_policy(test_name, policy_class, *args, **kwargs):
return policy return policy
def create_excuse(name): def create_excuse(name, pkgs):
return Excuse(name) excuse = Excuse(name)
for pkg_id in pkgs:
excuse.add_package(pkg_id)
return excuse
def create_source_package(name, version, section='devel', binaries=None): def create_source_package(name, version, section='devel', binaries=None):
@ -100,11 +103,11 @@ def create_bin_package(pkg_id, source_name=None, depends=None, conflicts=None):
) )
def create_policy_objects(source_name, target_version='1.0', source_version='2.0'): def create_policy_objects(source_name, target_version='1.0', source_version='2.0', pkgs={}):
return ( return (
create_source_package(source_name, target_version), create_source_package(source_name, target_version),
create_source_package(source_name, source_version), create_source_package(source_name, source_version),
create_excuse(source_name), create_excuse(source_name, pkgs),
) )
@ -113,7 +116,7 @@ def apply_src_policy(policy, expected_verdict, src_name, *, suite='unstable', ta
if src_name in suite_info[suite].sources: if src_name in suite_info[suite].sources:
src_u = suite_info[suite].sources[src_name] src_u = suite_info[suite].sources[src_name]
src_t = suite_info.target_suite.sources.get(src_name) src_t = suite_info.target_suite.sources.get(src_name)
_, _, excuse = create_policy_objects(src_name) _, _, excuse = create_policy_objects(src_name, pkgs=src_u.binaries)
else: else:
src_t, src_u, excuse = create_policy_objects(src_name, target_version, source_version) src_t, src_u, excuse = create_policy_objects(src_name, target_version, source_version)
suite_info.target_suite.sources[src_name] = src_t suite_info.target_suite.sources[src_name] = src_t

Loading…
Cancel
Save