autopkgtest: bug fix in baseline cache

ubuntu/rebased
Paul Gevers 6 years ago
parent 075d4d823b
commit 1ecb07ac2d
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -134,6 +134,8 @@ class AutopkgtestPolicy(BasePolicy):
# Make adt_baseline optional # Make adt_baseline optional
setattr(self.options, 'adt_baseline', None) setattr(self.options, 'adt_baseline', None)
self.result_in_baseline_cache = collections.defaultdict(dict)
# read the cached results that we collected so far # read the cached results that we collected so far
if os.path.exists(self.results_cache_file): if os.path.exists(self.results_cache_file):
with open(self.results_cache_file) as f: with open(self.results_cache_file) as f:
@ -895,7 +897,7 @@ class AutopkgtestPolicy(BasePolicy):
# this requires iterating over all cached results and thus is expensive; # this requires iterating over all cached results and thus is expensive;
# cache the results # cache the results
try: try:
return self.result_in_baseline._cache[src][arch] return self.result_in_baseline_cache[src][arch]
except KeyError: except KeyError:
pass pass
@ -909,7 +911,7 @@ class AutopkgtestPolicy(BasePolicy):
self.logger.info('Found NO result for src %s in reference: %s', self.logger.info('Found NO result for src %s in reference: %s',
src, result_reference.name) src, result_reference.name)
pass pass
self.result_in_baseline._cache[arch] = result_reference self.result_in_baseline_cache[src][arch] = deepcopy(result_reference)
return result_reference return result_reference
result_ever = Result.FAIL result_ever = Result.FAIL
@ -922,12 +924,10 @@ class AutopkgtestPolicy(BasePolicy):
except KeyError: except KeyError:
pass pass
self.result_in_baseline._cache[arch] = result_ever self.result_in_baseline_cache[src][arch] = deepcopy(result_ever)
self.logger.info('Result for src %s ever: %s', src, result_ever.name) self.logger.info('Result for src %s ever: %s', src, result_ever.name)
return result_ever return result_ever
result_in_baseline._cache = collections.defaultdict(dict)
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