diff --git a/autopkgtest.py b/autopkgtest.py index 7317f35..6c62f79 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -592,15 +592,18 @@ 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)) - for h in hints: - if same_source(h.version, testver): - result = 'IGNORE-FAIL' - break - else: - result = 'REGRESSION' + 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 + same_source(mi.version, testver)]: + result = 'IGNORE-FAIL' + break else: result = 'ALWAYSFAIL' diff --git a/britney.py b/britney.py index 4b41b0c..35d89c0 100755 --- a/britney.py +++ b/britney.py @@ -1061,7 +1061,7 @@ class Britney(object): self.__log("Ignoring %s[%s] = ('%s', '%s'), ('%s', '%s') is higher or equal" % (x, package, hint.version, hint.user, hint2.version, hint2.user), type="W") hint.set_active(False) - else: + elif x not in ["force-badtest", "force-skiptest"]: self.__log("Overriding %s[%s] = ('%s', '%s', '%s') with ('%s', '%s', '%s')" % (x, package, hint2.version, hint2.user, hint2.days, hint.version, hint.user, hint.days), type="W") diff --git a/tests/__init__.py b/tests/__init__.py index 31d5099..0c9f583 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -181,5 +181,6 @@ class TestBase(unittest.TestCase): hints_path = os.path.join( self.data.path, 'data', self.data.series + '-proposed', 'Hints', username) - with open(hints_path, 'w') as fd: + with open(hints_path, 'a') as fd: fd.write(content) + fd.write('\n') diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 94b649f..1110154 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -1262,6 +1262,47 @@ class T(TestBase): {'green': [('old-version', '1'), ('new-version', '2')] }) + def test_hint_force_badtest_multi_version(self): + '''force-badtest hint''' + + 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/i386/l/lightgreen/20150101_100101@': (4, 'lightgreen 1', tr('green/2')), + 'series/amd64/l/lightgreen/20150101_100100@': (0, 'lightgreen 1', tr('green/1')), + 'series/amd64/l/lightgreen/20150101_100101@': (4, 'lightgreen 2', tr('green/2')), + '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': (False, {'green 2': {'amd64': 'PASS', 'i386': 'PASS'}, + 'lightgreen 1': {'i386': 'IGNORE-FAIL'}, + 'lightgreen 2': {'amd64': 'REGRESSION',}, + 'darkgreen 1': {'amd64': 'PASS', 'i386': 'PASS'}, + }), + }, + {'green': [('old-version', '1'), ('new-version', '2')] + }) + + # hint the version on amd64 too + self.create_hint('pitti', 'force-badtest lightgreen/2') + + self.do_test( + [], + {'green': (True, {'green 2': {'amd64': 'PASS', 'i386': 'PASS'}, + 'lightgreen 1': {'i386': 'IGNORE-FAIL'}, + 'lightgreen 2': {'amd64': 'IGNORE-FAIL',}, + 'darkgreen 1': {'amd64': 'PASS', 'i386': 'PASS'}, + }), + }, + {'green': [('old-version', '1'), ('new-version', '2')] + }) + def test_hint_force_badtest_different_version(self): '''force-badtest hint with non-matching version'''