autopkgtest.py: Document method read() and code simplification

britney.py: code simplification
bzr-import-20160707
Jean-Baptiste Lallement 11 years ago
parent 1052dea946
commit 2a3a8cb657

@ -96,6 +96,18 @@ class AutoPackageTest(object):
yield linebits yield linebits
def read(self): def read(self):
'''Loads a list of results
This function loads a list of results returned by __parse() and builds
2 lists:
- a list of source package/version with all the causes that
triggered a test and the result of the test for this trigger.
- a list of packages/version that triggered a test with the source
package/version and result triggered by this package.
These lists will be used in result() called from britney.py to generate
excuses and now which uploads passed, caused regression or which tests
have always been failing
'''
self.pkglist = defaultdict(dict) self.pkglist = defaultdict(dict)
self.pkgcauses = defaultdict(lambda: defaultdict(list)) self.pkgcauses = defaultdict(lambda: defaultdict(list))
for linebits in self._parse(self._result_path): for linebits in self._parse(self._result_path):
@ -109,10 +121,8 @@ class AutoPackageTest(object):
i = iter(linebits[3:]) i = iter(linebits[3:])
for trigsrc, trigver in zip(i, i): for trigsrc, trigver in zip(i, i):
if not trigsrc in self.pkglist[src][ver]['causes']: self.pkglist[src][ver]['causes'].setdefault(
self.pkglist[src][ver]['causes'][trigsrc] = [] trigsrc, []).append((trigver, status))
self.pkglist[src][ver]['causes'][trigsrc].append((trigver,
status))
self.pkgcauses[trigsrc][trigver].append((status, src, ver)) self.pkgcauses[trigsrc][trigver].append((status, src, ver))
def _adt_britney(self, *args): def _adt_britney(self, *args):

@ -1762,9 +1762,7 @@ class Britney(object):
private_url = "%s/%s-adt-%s/lastBuild" % ( private_url = "%s/%s-adt-%s/lastBuild" % (
jenkins_private, self.options.adt_series, jenkins_private, self.options.adt_series,
adtsrc.replace("+", "-")) adtsrc.replace("+", "-"))
adt_label = status adt_label = ADT_EXCUSES_LABELS.get(status, status)
if status in ADT_EXCUSES_LABELS:
adt_label = ADT_EXCUSES_LABELS[status]
e.addhtml( e.addhtml(
"autopkgtest for %s %s: %s (Jenkins: " "autopkgtest for %s %s: %s (Jenkins: "
"<a href=\"%s\">public</a>, " "<a href=\"%s\">public</a>, "

Loading…
Cancel
Save