From 1ecb07ac2d10662ceb2ed0bd5308b76b7efe2b7e Mon Sep 17 00:00:00 2001 From: Paul Gevers Date: Sun, 23 Dec 2018 21:17:42 +0100 Subject: [PATCH] autopkgtest: bug fix in baseline cache --- britney2/policies/autopkgtest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index e0b1532..ac2ad6a 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -134,6 +134,8 @@ class AutopkgtestPolicy(BasePolicy): # Make adt_baseline optional setattr(self.options, 'adt_baseline', None) + self.result_in_baseline_cache = collections.defaultdict(dict) + # read the cached results that we collected so far if os.path.exists(self.results_cache_file): 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; # cache the results try: - return self.result_in_baseline._cache[src][arch] + return self.result_in_baseline_cache[src][arch] except KeyError: pass @@ -909,7 +911,7 @@ class AutopkgtestPolicy(BasePolicy): self.logger.info('Found NO result for src %s in reference: %s', src, result_reference.name) pass - self.result_in_baseline._cache[arch] = result_reference + self.result_in_baseline_cache[src][arch] = deepcopy(result_reference) return result_reference result_ever = Result.FAIL @@ -922,12 +924,10 @@ class AutopkgtestPolicy(BasePolicy): except KeyError: 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) return result_ever - result_in_baseline._cache = collections.defaultdict(dict) - def pkg_test_result(self, src, ver, arch, trigger): '''Get current test status of a particular package