autopkgtest: redefine regression, if possible, only take test results in testing into account

ubuntu/rebased
Paul Gevers 7 years ago
parent 054830d03f
commit adbe6d5f67
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -706,16 +706,46 @@ class AutopkgtestPolicy(BasePolicy):
self.send_test_request(src, arch, trigger, huge=huge) self.send_test_request(src, arch, trigger, huge=huge)
def check_ever_passed(self, src, arch): def check_ever_passed(self, src, arch):
'''Check if tests for src ever passed on arch''' '''Check if tests for src ever passed on arch for the current
version in testing (preferably) or, alternatively, ever'''
# FIXME: add caching # this requires iterating over all cached results and thus is expensive;
# cache the results
try:
return self.check_ever_passed._cache[src][arch]
except KeyError:
pass
check_ever_passed = False
check_passed_testing = False
tested_in_testing = False
try:
src_ver_in_testing = self.britney.sources['testing'][src][VERSION]
except KeyError:
src_ver_in_testing = None
for srcmap in self.test_results.values(): for srcmap in self.test_results.values():
try: try:
if srcmap[src][arch][0]: if srcmap[src][arch][0]:
return True check_ever_passed = True
if srcmap[src][arch][1] == src_ver_in_testing:
tested_in_testing = True
if srcmap[src][arch][0]:
check_passed_testing = True
break
except KeyError: except KeyError:
pass pass
return False
if tested_in_testing:
self.check_ever_passed._cache.setdefault(src, {})[arch] = check_passed_testing
self.log('Found passing result for src %s in testing: %s' % (src, check_passed_testing))
return check_passed_testing
else:
self.check_ever_passed._cache.setdefault(src, {})[arch] = check_ever_passed
self.log('Found passing result for src %s ever: %s' % (src, check_ever_passed))
return check_ever_passed
check_ever_passed._cache = {}
def pkg_test_result(self, src, ver, arch, trigger): def pkg_test_result(self, src, ver, arch, trigger):
'''Get current test status of a particular package '''Get current test status of a particular package

Loading…
Cancel
Save