mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-03 14:41:30 +00:00
Implementing boottest entry points for checking phone-image presence and test current status.
This commit is contained in:
parent
fe5f4c09ac
commit
f7e1fa67c0
46
boottest.py
46
boottest.py
@ -26,13 +26,45 @@ class BootTest(object):
|
|||||||
self.series = series
|
self.series = series
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
def check(self, excuse):
|
|
||||||
"""Check and update given 'excuse' and return its label."""
|
def _source_in_image(self, name):
|
||||||
label = 'IN PROGRESS'
|
"""Whether or not the given source name is in the phone image."""
|
||||||
# XXX cprov 20150120: replace with a phone image manifest/content
|
# XXX cprov 20150120: replace with a phone image manifest/content
|
||||||
# check.
|
# check.
|
||||||
if excuse.name == 'apache2':
|
if name == 'apache2':
|
||||||
label = 'SKIPPED'
|
return False
|
||||||
excuse.is_valid = False
|
|
||||||
|
|
||||||
return label
|
return True
|
||||||
|
|
||||||
|
def _get_status_label(self, name, version):
|
||||||
|
"""Return the current boottest status label."""
|
||||||
|
# XXX cprov 20150120: replace with the test history latest
|
||||||
|
# record label.
|
||||||
|
if name == 'pyqt5':
|
||||||
|
if version == '1.1~beta':
|
||||||
|
return 'PASS'
|
||||||
|
return 'FAIL'
|
||||||
|
|
||||||
|
return 'IN PROGRESS'
|
||||||
|
|
||||||
|
def update(self, excuse):
|
||||||
|
"""Update given 'excuse' and return True if it has failed.
|
||||||
|
|
||||||
|
Annotate skipped packages (currently not in phone image) or add
|
||||||
|
the current testing status (see `_get_status_label`).
|
||||||
|
"""
|
||||||
|
if not self._source_in_image(excuse.name):
|
||||||
|
label = 'SKIPPED'
|
||||||
|
else:
|
||||||
|
label = self._get_status_label(excuse.name, excuse.ver[1])
|
||||||
|
|
||||||
|
excuse.addhtml("boottest for %s %s: %s" %
|
||||||
|
(excuse.name, excuse.ver[1], label))
|
||||||
|
|
||||||
|
if label in ['PASS', 'SKIPPED']:
|
||||||
|
return False
|
||||||
|
|
||||||
|
excuse.addhtml("Not considered")
|
||||||
|
excuse.addreason("boottest")
|
||||||
|
excuse.is_valid = False
|
||||||
|
return True
|
||||||
|
15
britney.py
15
britney.py
@ -1887,16 +1887,21 @@ class Britney(object):
|
|||||||
|
|
||||||
if (getattr(self.options, "boottest_enable", "no") == "yes" and
|
if (getattr(self.options, "boottest_enable", "no") == "yes" and
|
||||||
self.options.series):
|
self.options.series):
|
||||||
# trigger autopkgtests for valid candidates
|
# trigger 'boottest'ing for valid candidates.
|
||||||
boottest_debug = getattr(
|
boottest_debug = getattr(
|
||||||
self.options, "boottest_debug", "no") == "yes"
|
self.options, "boottest_debug", "no") == "yes"
|
||||||
boottest = BootTest(
|
boottest = BootTest(
|
||||||
self, self.options.distribution, self.options.series,
|
self, self.options.distribution, self.options.series,
|
||||||
debug=boottest_debug)
|
debug=boottest_debug)
|
||||||
for e in self.excuses:
|
for excuse in self.excuses:
|
||||||
boottest_label = boottest.check(e)
|
# Skip already invalid excuses.
|
||||||
e.addhtml("boottest for %s %s: %s" %
|
if not excuse.is_valid:
|
||||||
(e.name, e.ver[1], boottest_label))
|
continue
|
||||||
|
# Update valid excuses from the boottest context and if they
|
||||||
|
# have failed, block their migration.
|
||||||
|
if boottest.update(excuse):
|
||||||
|
upgrade_me.remove(excuse.name)
|
||||||
|
unconsidered.append(excuse.name)
|
||||||
|
|
||||||
# invalidate impossible excuses
|
# invalidate impossible excuses
|
||||||
for e in self.excuses:
|
for e in self.excuses:
|
||||||
|
@ -17,10 +17,11 @@ sys.path.insert(0, PROJECT_DIR)
|
|||||||
from tests import TestBase
|
from tests import TestBase
|
||||||
|
|
||||||
|
|
||||||
class TestBoottest(TestBase):
|
class TestBoottestEnd2End(TestBase):
|
||||||
|
"""End2End tests (calling `britney`) for the BootTest criteria."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestBoottest, self).setUp()
|
super(TestBoottestEnd2End, self).setUp()
|
||||||
self.britney_conf = os.path.join(
|
self.britney_conf = os.path.join(
|
||||||
PROJECT_DIR, 'britney_boottest.conf')
|
PROJECT_DIR, 'britney_boottest.conf')
|
||||||
self.data.add('libc6', False)
|
self.data.add('libc6', False)
|
||||||
@ -48,23 +49,51 @@ class TestBoottest(TestBase):
|
|||||||
|
|
||||||
def test_runs(self):
|
def test_runs(self):
|
||||||
# `Britney` runs and considers packages for boottesting when
|
# `Britney` runs and considers packages for boottesting when
|
||||||
# it is enabled in the configuration.
|
# it is enabled in the configuration and 'in progress' tests
|
||||||
|
# blocks package promotion.
|
||||||
context = []
|
context = []
|
||||||
context.append(
|
context.append(
|
||||||
('green', {'Version': '1.1~beta', 'Depends': 'libc6 (>= 0.9)'}))
|
('green', {'Version': '1.1~beta', 'Depends': 'libc6 (>= 0.9)'}))
|
||||||
self.do_test(
|
self.do_test(
|
||||||
context,
|
context,
|
||||||
['<li>boottest for green 1.1~beta: IN PROGRESS'])
|
['<li>boottest for green 1.1~beta: IN PROGRESS',
|
||||||
|
'<li>Not considered'])
|
||||||
|
|
||||||
|
def test_pass(self):
|
||||||
|
# `Britney` updates boottesting information in excuses when the
|
||||||
|
# package test pass and marks the package as a valid candidate for
|
||||||
|
# promotion.
|
||||||
|
context = []
|
||||||
|
context.append(
|
||||||
|
('pyqt5', {'Version': '1.1~beta'}))
|
||||||
|
self.do_test(
|
||||||
|
context,
|
||||||
|
['<li>boottest for pyqt5 1.1~beta: PASS',
|
||||||
|
'<li>Valid candidate'])
|
||||||
|
|
||||||
|
def test_fail(self):
|
||||||
|
# `Britney` updates boottesting information in excuses when the
|
||||||
|
# package test fails and blocks the package promotion
|
||||||
|
# ('Not considered.')
|
||||||
|
context = []
|
||||||
|
context.append(
|
||||||
|
('pyqt5', {'Version': '1.1'}))
|
||||||
|
self.do_test(
|
||||||
|
context,
|
||||||
|
['<li>boottest for pyqt5 1.1: FAIL',
|
||||||
|
'<li>Not considered'])
|
||||||
|
|
||||||
def test_skipped(self):
|
def test_skipped(self):
|
||||||
# `Britney` updates boottesting information in excuses when the
|
# `Britney` updates boottesting information in excuses when the
|
||||||
# package was skipped.
|
# package was skipped and marks the package as a valid candidate for
|
||||||
|
# promotion.
|
||||||
context = []
|
context = []
|
||||||
context.append(
|
context.append(
|
||||||
('apache2', {'Version': '2.4.8-1ubuntu1'}))
|
('apache2', {'Version': '2.4.8-1ubuntu1'}))
|
||||||
self.do_test(
|
self.do_test(
|
||||||
context,
|
context,
|
||||||
['<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED'])
|
['<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED',
|
||||||
|
'<li>Valid candidate'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user