diff --git a/autopkgtest.py b/autopkgtest.py index 8e43d88..54f4ffb 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -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)]: - result = 'IGNORE-FAIL' - break + if self.has_force_badtest(testsrc, testver, arch): + result = 'IGNORE-FAIL' + 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, diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 8f7615d..a827fca 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -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'''