autopkgtest: rewrite processing of debci2britney data

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

@ -124,29 +124,30 @@ class AutopkgtestPolicy(BasePolicy):
with open(debci_file) as f: with open(debci_file) as f:
test_results = json.load(f) test_results = json.load(f)
self.log('Read new results from %s' % debci_file) self.log('Read new results from %s' % debci_file)
# With debci, pending tests are determined from the debci file
self.pending_tests = {}
for res in test_results['results']: for res in test_results['results']:
# status == null means still running # Blacklisted tests don't get a version
# trigger == null means not automatically requested if res['version'] is None:
if res['status'] is not None and res['trigger'] is not None: res['version'] = 'blacklisted'
# Blacklisted tests don't get a version (trigger, src, arch, ver, status, stamp) = ([res['trigger'], res['package'], res['arch'], res['version'], res['status'], str(res['run_id'])])
if res['version'] is None: if trigger is None:
res['version'] = 'blacklisted' # not requested for this policy, so ignore
(trigger, src, arch, ver, passed, stamp) = ([res['trigger'], res['package'], res['arch'], res['version'], res['status'] == 'pass', str(res['run_id'])]) continue
self.add_trigger_to_results(trigger, src, ver, arch, stamp, passed) if status is None:
self.remove_from_pending(trigger, src, arch) # still running => pending
self.log("Checking if britney's pending tests are known to debci") arch_list = self.pending_tests.setdefault(trigger, {}).setdefault(src, [])
pending_tests = copy.deepcopy(self.pending_tests) # copy because we may change the content if arch not in arch_list:
for trigger in pending_tests: self.log('Pending autopkgtest %s on %s to verify %s' %
for package in pending_tests[trigger]: (src, arch, trigger))
for arch in pending_tests[trigger][package]: arch_list.append(arch)
found = False arch_list.sort()
for res in test_results['results']: elif status == 'tmpfail':
if res['trigger'] == trigger and res['package'] == package and res['arch'] == arch: # let's see if we still need it
found = True continue
break else:
if not found: self.log('Results %s %s %s added' % (src, trigger, status))
self.log("Removing %s for %s on %s from britney's pending list as it isn't on debci's list" % (package, trigger, arch), 'W') self.add_trigger_to_results(trigger, src, ver, arch, stamp, status == 'pass')
self.remove_from_pending(trigger, package, arch)
else: else:
self.log('%s does not exist, no new data will be processed' % self.log('%s does not exist, no new data will be processed' %
debci_file) debci_file)

Loading…
Cancel
Save