Request boottests for sources, not binaries. Jenkins glue will drive adt properly.

This commit is contained in:
Celso Providelo 2015-02-03 12:27:22 -05:00
parent 49f0a5b3ff
commit 06ea2ab941
3 changed files with 49 additions and 56 deletions

@ -92,8 +92,8 @@ class BootTestJenkinsJob(object):
Wraps 'boottest/jenkins/boottest-britney' script for:
* 'check' existing boottest job status ('check <binary> <version>')
* 'submit' new boottest jobs ('submit <binary> <version>')
* 'check' existing boottest job status ('check <source> <version>')
* 'submit' new boottest jobs ('submit <source> <version>')
"""
@ -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 "<binname>/<arch>" 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

@ -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

@ -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</a> to .*>1.1~beta<',
'<li>boottest for green 1.1~beta: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['RUNNING']),
'<li>boottest for libgreen1 1.1~beta: {}'.format(
BootTest.EXCUSE_LABELS['SKIPPED']),
'<li>Not considered'])
def test_pass(self):
@ -243,7 +241,7 @@ args.func()
self.do_test(
context,
[r'\bpyqt5-src\b.*\(- to .*>1.1~beta<',
'<li>boottest for pyqt5 1.1~beta: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['PASS']),
'<li>Valid candidate'])
@ -258,7 +256,7 @@ args.func()
self.do_test(
context,
[r'\bpyqt5-src\b.*\(- to .*>1.1<',
'<li>boottest for pyqt5 1.1: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['FAIL']),
'<li>Not considered'])
@ -283,9 +281,10 @@ args.func()
self.do_test(
context,
[r'\bpyqt5-src\b.*\(- to .*>1.1<',
'<li>boottest for pyqt5 1.1: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['FAIL']),
'<li>Should wait for pyqt5 1.1 boottest, but forced by cjwatson',
'<li>Should wait for pyqt5-src 1.1 boottest, '
'but forced by cjwatson',
'<li>Valid candidate'])
def test_fail_but_skipped_by_hints(self):
@ -298,7 +297,7 @@ args.func()
self.do_test(
context,
[r'\bgreen\b.*>1</a> to .*>1.1~beta<',
'<li>boottest for green 1.1~beta: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['RUNNING']),
'<li>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<',
'<li>boottest for apache2 2.4.8-1ubuntu1: {}'.format(
'<li>Boottest result: {}'.format(
BootTest.EXCUSE_LABELS['SKIPPED']),
'<li>Valid candidate'])