diff --git a/boottest.py b/boottest.py index 0815061..93caf60 100644 --- a/boottest.py +++ b/boottest.py @@ -92,8 +92,8 @@ class BootTestJenkinsJob(object): Wraps 'boottest/jenkins/boottest-britney' script for: - * 'check' existing boottest job status ('check ') - * 'submit' new boottest jobs ('submit ') + * 'check' existing boottest job status ('check ') + * 'submit' new boottest jobs ('submit ') """ @@ -155,32 +155,36 @@ class BootTest(object): self.dispatcher = BootTestJenkinsJob(self.distribution, self.series) def update(self, excuse): - """Update given 'excuse' and yields testing status. + """Return the boottest status for the given excuse. - Yields (status, binary_name) for each binary considered for the - given excuse. See `BootTestJenkinsJob.get_status`. + A new boottest job will be requested if the the source was not + yet processed, otherwise the status of the corresponding job will + be returned. - Binaries are considered for boottesting if they are part of the - phone image manifest. See `TouchManifest`. + Sources are only considered for boottesting if they produce binaries + that are part of the phone image manifest. See `TouchManifest`. """ # 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 + return None + # Binaries are a seq of "/" and, practically, boottest - # is only concerned about armhf+all binaries. - # Anything else should be skipped. - binary_names = [ - b.split('/')[0] - for b in unstable_sources[excuse.name][BINARIES] + # is only concerned about armhf binaries mentioned in the phone + # manifest. Anything else should be skipped. + phone_binaries = [ + b for b in unstable_sources[excuse.name][BINARIES] if b.split('/')[1] in self.britney.options.boottest_arches.split() + and b.split('/')[0] in self.phone_manifest ] - # Process (request or update) boottest attempts for each binary. - for name in binary_names: - if name in self.phone_manifest: - status = self.dispatcher.get_status(name, excuse.ver[1]) - else: - status = 'SKIPPED' - yield name, status + # Process (request or update) a boottest attempt for the source + # if one or more of its binaries are part of the phone image. + if phone_binaries: + status = self.dispatcher.get_status(excuse.name, excuse.ver[1]) + else: + status = 'SKIPPED' + + return status diff --git a/britney.py b/britney.py index b8fe4a0..792c6f7 100755 --- a/britney.py +++ b/britney.py @@ -1919,36 +1919,26 @@ class Britney(object): "_" in excuse.name or excuse.ver[1] == "-"): continue - statuses = set() # 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)) - # Allows hints to force boottest failures/attempts - # to be ignored. - hints = self.hints.search('force', package=excuse.name) - hints.extend( - self.hints.search( - 'force-skiptest', package=excuse.name)) - forces = [ - x for x in hints - if same_source(excuse.ver[1], x.version)] - if forces: - excuse.addhtml( - "Should wait for %s %s boottest, but forced by " - "%s" % (binary_name, excuse.ver[1], - forces[0].user)) - status = 'PASS' - statuses.add(status) - # No boottest attempts requested, it's not relevant in this - # context, rely on other checks to judge promotion. - if not statuses: + status = boottest.update(excuse) + label = BootTest.EXCUSE_LABELS.get(status, 'UNKNOWN STATUS') + excuse.addhtml("Boottest result: %s" % (label)) + # Allows hints to force boottest failures/attempts + # to be ignored. + hints = self.hints.search('force', package=excuse.name) + hints.extend( + self.hints.search('force-skiptest', package=excuse.name)) + forces = [x for x in hints + if same_source(excuse.ver[1], x.version)] + if forces: + excuse.addhtml( + "Should wait for %s %s boottest, but forced by " + "%s" % (excuse.name, excuse.ver[1], + forces[0].user)) continue # Block promotion if any boottests attempt has failed or # still in progress. - if not statuses.issubset(set(BootTest.VALID_STATUSES)): + if status not in BootTest.VALID_STATUSES: excuse.addhtml("Not considered") excuse.addreason("boottest") excuse.is_valid = False diff --git a/tests/test_boottest.py b/tests/test_boottest.py index e9f7af8..b268c1a 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -172,7 +172,7 @@ def submit(): print 'RUNNING' def check(): - if args.name != 'pyqt5': + if args.name != 'pyqt5-src': sys.exit(100) if args.version == '1.1~beta': print 'PASS' @@ -226,10 +226,8 @@ args.func() self.do_test( context, [r'\bgreen\b.*>1 to .*>1.1~beta<', - '
  • boottest for green 1.1~beta: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['RUNNING']), - '
  • boottest for libgreen1 1.1~beta: {}'.format( - BootTest.EXCUSE_LABELS['SKIPPED']), '
  • Not considered']) def test_pass(self): @@ -243,7 +241,7 @@ args.func() self.do_test( context, [r'\bpyqt5-src\b.*\(- to .*>1.1~beta<', - '
  • boottest for pyqt5 1.1~beta: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['PASS']), '
  • Valid candidate']) @@ -258,7 +256,7 @@ args.func() self.do_test( context, [r'\bpyqt5-src\b.*\(- to .*>1.1<', - '
  • boottest for pyqt5 1.1: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['FAIL']), '
  • Not considered']) @@ -283,9 +281,10 @@ args.func() self.do_test( context, [r'\bpyqt5-src\b.*\(- to .*>1.1<', - '
  • boottest for pyqt5 1.1: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['FAIL']), - '
  • Should wait for pyqt5 1.1 boottest, but forced by cjwatson', + '
  • Should wait for pyqt5-src 1.1 boottest, ' + 'but forced by cjwatson', '
  • Valid candidate']) def test_fail_but_skipped_by_hints(self): @@ -298,7 +297,7 @@ args.func() self.do_test( context, [r'\bgreen\b.*>1 to .*>1.1~beta<', - '
  • boottest for green 1.1~beta: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['RUNNING']), '
  • Should wait for green 1.1~beta boottest, but forced ' 'by cjwatson', @@ -315,7 +314,7 @@ args.func() self.do_test( context, [r'\bapache2-src\b.*\(- to .*>2.4.8-1ubuntu1<', - '
  • boottest for apache2 2.4.8-1ubuntu1: {}'.format( + '
  • Boottest result: {}'.format( BootTest.EXCUSE_LABELS['SKIPPED']), '
  • Valid candidate'])