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
# trigger == null means not automatically requested
if res['status'] is not None and res['trigger'] is not None:
# Blacklisted tests don't get a version # Blacklisted tests don't get a version
if res['version'] is None: if res['version'] is None:
res['version'] = 'blacklisted' res['version'] = 'blacklisted'
(trigger, src, arch, ver, passed, stamp) = ([res['trigger'], res['package'], res['arch'], res['version'], res['status'] == 'pass', str(res['run_id'])]) (trigger, src, arch, ver, status, stamp) = ([res['trigger'], res['package'], res['arch'], res['version'], res['status'], str(res['run_id'])])
self.add_trigger_to_results(trigger, src, ver, arch, stamp, passed) if trigger is None:
self.remove_from_pending(trigger, src, arch) # not requested for this policy, so ignore
self.log("Checking if britney's pending tests are known to debci") continue
pending_tests = copy.deepcopy(self.pending_tests) # copy because we may change the content if status is None:
for trigger in pending_tests: # still running => pending
for package in pending_tests[trigger]: arch_list = self.pending_tests.setdefault(trigger, {}).setdefault(src, [])
for arch in pending_tests[trigger][package]: if arch not in arch_list:
found = False self.log('Pending autopkgtest %s on %s to verify %s' %
for res in test_results['results']: (src, arch, trigger))
if res['trigger'] == trigger and res['package'] == package and res['arch'] == arch: arch_list.append(arch)
found = True arch_list.sort()
break elif status == 'tmpfail':
if not found: # let's see if we still need it
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') continue
self.remove_from_pending(trigger, package, arch) else:
self.log('Results %s %s %s added' % (src, trigger, status))
self.add_trigger_to_results(trigger, src, ver, arch, stamp, status == 'pass')
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