From eeaf8e3deb3be8021e2d12bb59507152992fc99b Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Thu, 22 Jan 2015 21:30:03 -0200 Subject: [PATCH] Silently skipping boottesting for sources not yet built on the allowed architectures (all and armhf). --- boottest.py | 10 ++++++++-- britney.py | 19 ++++++++++++++----- tests/test_boottest.py | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/boottest.py b/boottest.py index 1f576ba..1631080 100644 --- a/boottest.py +++ b/boottest.py @@ -75,6 +75,8 @@ class BootTest(object): "RUNNING": 'Test in progress', } + ARCHITECTURES = ('all', 'armhf') + def __init__(self, britney, distribution, series, debug=False): self.britney = britney self.distribution = distribution @@ -107,12 +109,16 @@ class BootTest(object): """ # Discover all binaries for the 'excused' source. unstable_sources = self.britney.sources['unstable'] + # Dismiss if source is not yet recognized (??). + if excuse.name not in unstable_sources: + raise StopIteration # XXX cprov 20150120: binaries are a seq of "/" and, # practically, boottest is only concerned about armhf+all binaries. # Anything else should be skipped. binary_names = [ - bin.split('/')[0] - for bin in unstable_sources[excuse.name][BINARIES] + b.split('/')[0] + for b in unstable_sources[excuse.name][BINARIES] + if b.split('/')[1] in self.ARCHITECTURES ] # Process (request or update) boottest attempts for each binary. diff --git a/britney.py b/britney.py index b9c182d..2b98eb4 100755 --- a/britney.py +++ b/britney.py @@ -1897,18 +1897,27 @@ class Britney(object): # Skip already invalid excuses. if not excuse.is_valid: continue + # Also skip removals, binary-only candidates, proposed-updates + # and unknown versions. + if (e.name.startswith("-") or + "/" in e.name or + "_" in e.name or + e.ver[1] == "-"): + continue statuses = set() - # Update valid excuses from the boottest context and if they - # have failed, block their migration. + # Update valid excuses from the boottest context. for binary_name, status in boottest.update(excuse): label = BootTest.EXCUSE_LABELS.get( status, 'UNKNOWN STATUS') excuse.addhtml("boottest for %s %s: %s" % (binary_name, excuse.ver[1], label)) statuses.add(status) - # If all boottests passed or were skipped, the excuse is - # clean and promotion can proceed, according to the - # boottest criteria. Otherwise block the promotion. + # No boottest attemps requested, it's not relevant in this + # context, rely on other checks to judge promotion. + if not statuses: + continue + # Block promotion if any boottests attempt has failed or + # still in progress. if not statuses.issubset(set(BootTest.VALID_STATUSES)): excuse.addhtml("Not considered") excuse.addreason("boottest") diff --git a/tests/test_boottest.py b/tests/test_boottest.py index c15d0ed..2b80de6 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -76,15 +76,18 @@ class TestBoottestEnd2End(TestBase): super(TestBoottestEnd2End, self).setUp() self.britney_conf = os.path.join( PROJECT_DIR, 'britney_boottest.conf') - self.data.add('libc6', False) + self.data.add('libc6', False, {'Architecture': 'armhf'}), + self.data.add( 'libgreen1', False, - {'Source': 'green', 'Depends': 'libc6 (>= 0.9)'}) + {'Source': 'green', 'Architecture': 'armhf', + 'Depends': 'libc6 (>= 0.9)'}) self.data.add( 'green', False, - {'Source': 'green', 'Depends': 'libc6 (>= 0.9), libgreen1'}) + {'Source': 'green', 'Architecture': 'armhf', + 'Depends': 'libc6 (>= 0.9), libgreen1'}) self.create_manifest([ 'green 1.0', 'pyqt5:armhf 1.0', @@ -117,8 +120,9 @@ class TestBoottestEnd2End(TestBase): # 'in progress' tests blocks package promotion. context = [ ('green', {'Source': 'green', 'Version': '1.1~beta', - 'Depends': 'libc6 (>= 0.9)'}), + 'Architecture': 'armhf', 'Depends': 'libc6 (>= 0.9)'}), ('libgreen1', {'Source': 'green', 'Version': '1.1~beta', + 'Architecture': 'armhf', 'Depends': 'libc6 (>= 0.9)'}), ] self.do_test( @@ -136,7 +140,8 @@ class TestBoottestEnd2End(TestBase): # promotion. context = [] context.append( - ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1~beta'})) + ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1~beta', + 'Architecture': 'all'})) self.do_test( context, [r'\bpyqt5-src\b.*\(- to .*>1.1~beta<', @@ -150,7 +155,8 @@ class TestBoottestEnd2End(TestBase): # ('Not considered.') context = [] context.append( - ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1'})) + ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1', + 'Architecture': 'all'})) self.do_test( context, [r'\bpyqt5-src\b.*\(- to .*>1.1<', @@ -158,13 +164,13 @@ class TestBoottestEnd2End(TestBase): BootTest.EXCUSE_LABELS['FAIL']), '
  • Not considered']) - def test_skipped(self): + def test_skipped_not_on_phone(self): # `Britney` updates boottesting information in excuses when the # package was skipped and marks the package as a valid candidate for # promotion. context = [] context.append( - ('apache2', {'Source': 'apache2-src', + ('apache2', {'Source': 'apache2-src', 'Architecture': 'all', 'Version': '2.4.8-1ubuntu1'})) self.do_test( context, @@ -173,6 +179,22 @@ class TestBoottestEnd2End(TestBase): BootTest.EXCUSE_LABELS['SKIPPED']), '
  • Valid candidate']) + def test_skipped_architecture_not_allowed(self): + # `Britney` does not trigger boottests for source not yet built on + # the allowed architectures. + self.data.add( + 'pyqt5', False, {'Source': 'pyqt5-src', 'Architecture': 'armhf'}) + context = [ + ('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1', + 'Architecture': 'amd64'}), + ] + self.do_test( + context, + [r'\bpyqt5-src\b.*>1 to .*>1.1<', + r'
  • missing build on .*>armhf: pyqt5 \(from .*>1\)', + '
  • Not considered']) + + if __name__ == '__main__': unittest.main()