Make force-badtest hints apply to running tests

Sometimes it's desirable to force a test while it is still in progress - maybe
for an infrastructure bug, or maybe because you just don't want to wait that
long for another reason.
bzr-import-20160707
Martin Pitt 9 years ago
parent e43cec8fad
commit e59a32106f

@ -29,8 +29,6 @@ from urllib.request import urlopen
import apt_pkg
import amqplib.client_0_8 as amqp
from britney_util import same_source
from consts import (AUTOPKGTEST, BINARIES, DEPENDS, RDEPENDS, SOURCE, VERSION)
@ -527,6 +525,20 @@ class AutoPackageTest(object):
pass
return False
def has_force_badtest(self, src, ver, arch):
'''Check if src/ver/arch has a force-badtest hint'''
hints = self.britney.hints.search('force-badtest', package=src)
hints.extend(self.britney.hints.search('force', package=src))
if hints:
self.log_verbose('Checking hints for %s/%s/%s: %s' % (src, ver, arch, [str(h) for h in hints]))
for hint in hints:
if [mi for mi in hint.packages if mi.architecture in ['source', arch] and
(mi.version == 'all' or apt_pkg.version_compare(ver, mi.version) <= 0)]:
return True
return False
#
# Public API
#
@ -601,18 +613,10 @@ class AutoPackageTest(object):
ever_passed = False
if ever_passed:
result = 'REGRESSION'
# do we have a force{,-badtest} hint?
hints = self.britney.hints.search('force-badtest', package=testsrc)
hints.extend(self.britney.hints.search('force', package=testsrc))
if hints:
self.log_verbose('Checking hints for %s/%s/%s: %s' % (testsrc, testver, arch, [str(h) for h in hints]))
for hint in hints:
if [mi for mi in hint.packages if mi.architecture in ['source', arch] and
(mi.version == 'all' or apt_pkg.version_compare(testver, mi.version) <= 0)]:
if self.has_force_badtest(testsrc, testver, arch):
result = 'IGNORE-FAIL'
break
else:
result = 'REGRESSION'
else:
result = 'ALWAYSFAIL'
@ -627,7 +631,10 @@ class AutoPackageTest(object):
except KeyError:
# no result for testsrc/arch; still running?
if arch in self.pending_tests.get(trigger, {}).get(testsrc, []):
result = ever_passed and 'RUNNING' or 'RUNNING-ALWAYSFAIL'
if ever_passed and not self.has_force_badtest(testsrc, testver, arch):
result = 'RUNNING'
else:
result = 'RUNNING-ALWAYSFAIL'
url = 'http://autopkgtest.ubuntu.com/running.shtml'
else:
# ignore if adt or swift results are disabled,

@ -1433,6 +1433,30 @@ class T(TestBase):
{'green': [('old-version', '1'), ('new-version', '2')]
})
def test_hint_force_badtest_running(self):
'''force-badtest hint on running test'''
self.swift.set_results({'autopkgtest-series': {
'series/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1', tr('green/2')),
'series/amd64/d/darkgreen/20150101_100000@': (0, 'darkgreen 1', tr('green/2')),
'series/i386/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/1')),
'series/amd64/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/1')),
'series/i386/g/green/20150101_100200@': (0, 'green 2', tr('green/2')),
'series/amd64/g/green/20150101_100200@': (0, 'green 2', tr('green/2')),
}})
self.create_hint('pitti', 'force-badtest lightgreen/1')
self.do_test(
[('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')],
{'green': (True, {'green 2': {'amd64': 'PASS', 'i386': 'PASS'},
'lightgreen': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
'darkgreen 1': {'amd64': 'PASS', 'i386': 'PASS'},
}),
},
{'green': [('old-version', '1'), ('new-version', '2')]
})
def test_hint_force_skiptest(self):
'''force-skiptest hint'''

Loading…
Cancel
Save