autopkgtest.py:

- A test for a package/version can be triggered by several distincts causes with different results. Modify the data structure to store this instead of only storing the last cause and result, leading to missing test results in excuses.
- Check if failures are regressions (there is at least one pass and migration is blocked) or if test has always been failing. In the latter case, migration is not blocked.
- Add colours to excuses.html to distinguishes the test results
- Point jenkins URL to lastBuild
bzr-import-20160707
Jean-Baptiste Lallement 11 years ago
parent 3948558ac2
commit 7e80d47eb6

@ -19,18 +19,24 @@ from __future__ import print_function
from collections import defaultdict from collections import defaultdict
from contextlib import closing from contextlib import closing
import logging
import os import os
import subprocess import subprocess
import tempfile import tempfile
from textwrap import dedent from textwrap import dedent
import time import time
import apt_pkg import apt_pkg
adt_britney = os.path.expanduser("~/auto-package-testing/jenkins/adt-britney") adt_britney = os.path.expanduser("~/auto-package-testing/jenkins/adt-britney")
ADT_PASS = ["PASS", "ALWAYSFAIL"]
ADT_EXCUSES_LABELS = {
"PASS": '<span style="background:#87d96c">Pass</span>',
"ALWAYSFAIL": '<span style="background:#e5c545">Always failed</span>',
"REGRESSION": '<span style="background:#ff6666">Regression</span>',
"RUNNING": '<span style="background:#99ddff">Test in progress</span>',
}
class AutoPackageTest(object): class AutoPackageTest(object):
"""autopkgtest integration """autopkgtest integration
@ -85,8 +91,7 @@ class AutoPackageTest(object):
continue continue
linebits = line.split() linebits = line.split()
if len(linebits) < 2: if len(linebits) < 2:
logging.warning( print("W: Invalid line format: '%s', skipped" % line)
"Invalid line format: '%s', skipped" % line)
continue continue
yield linebits yield linebits
@ -94,28 +99,20 @@ class AutoPackageTest(object):
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):
src = linebits.pop(0) (src, ver, status) = linebits[:3]
ver = linebits.pop(0)
if not (src in self.pkglist and ver in self.pkglist[src]):
self.pkglist[src][ver] = { self.pkglist[src][ver] = {
"status": "NEW", "status": status,
"causes": {}, "causes": {}
} }
try:
status = linebits.pop(0).upper() i = iter(linebits[3:])
self.pkglist[src][ver]["status"] = status for trigsrc, trigver in zip(i, i):
while True: if not trigsrc in self.pkglist[src][ver]['causes']:
trigsrc = linebits.pop(0) self.pkglist[src][ver]['causes'][trigsrc] = []
trigver = linebits.pop(0) self.pkglist[src][ver]['causes'][trigsrc].append((trigver,
self.pkglist[src][ver]["causes"][trigsrc] = trigver status))
except IndexError:
# End of the list
pass
for src in self.pkglist:
all_vers = sorted(self.pkglist[src], cmp=apt_pkg.version_compare)
for ver in self.pkglist[src]:
status = self.pkglist[src][ver]["status"]
for trigsrc, trigver in \
self.pkglist[src][ver]["causes"].items():
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):
@ -197,12 +194,29 @@ class AutoPackageTest(object):
self.read() self.read()
if self.britney.options.verbose: if self.britney.options.verbose:
for src in sorted(self.pkglist): for src in sorted(self.pkglist):
for ver in self.pkglist[src]: for ver in sorted(self.pkglist[src],
print("I: [%s] - Collected autopkgtest status for %s_%s: " cmp=apt_pkg.version_compare):
"%s" % for trigsrc in sorted(self.pkglist[src][ver]['causes']):
(time.asctime(), src, ver, for trigver, status \
self.pkglist[src][ver]["status"])) in self.pkglist[src][ver]['causes'][trigsrc]:
print("I: [%s] - Collected autopkgtest status "
"for %s_%s/%s_%s: " "%s" % (
time.asctime(), src, ver, trigsrc,
trigver, status))
def results(self, trigsrc, trigver): def results(self, trigsrc, trigver):
for status, src, ver in self.pkgcauses[trigsrc][trigver]: for status, src, ver in self.pkgcauses[trigsrc][trigver]:
# Check for regresssion
if status == 'FAIL':
passed_once = False
for ver in self.pkglist[src]:
for trigsrc in self.pkglist[src][ver]['causes']:
for trigver, status \
in self.pkglist[src][ver]['causes'][trigsrc]:
if status == 'PASS':
passed_once = True
if not passed_once:
status = 'ALWAYSFAIL'
else:
status = 'REGRESSION'
yield status, src, ver yield status, src, ver

@ -222,7 +222,7 @@ from britney_util import (old_libraries_format, same_source, undo_changes,
from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC, from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS, SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
PROVIDES, RDEPENDS, RCONFLICTS, MULTIARCH) PROVIDES, RDEPENDS, RCONFLICTS, MULTIARCH)
from autopkgtest import AutoPackageTest from autopkgtest import AutoPackageTest, ADT_PASS, ADT_EXCUSES_LABELS
__author__ = 'Fabio Tranchitella and the Debian Release Team' __author__ = 'Fabio Tranchitella and the Debian Release Team'
__version__ = '2.0' __version__ = '2.0'
@ -1756,18 +1756,21 @@ class Britney(object):
adtpass = True adtpass = True
for status, adtsrc, adtver in autopkgtest.results( for status, adtsrc, adtver in autopkgtest.results(
e.name, e.ver[1]): e.name, e.ver[1]):
public_url = "%s/%s-adt-%s/" % ( public_url = "%s/%s-adt-%s/lastBuild" % (
jenkins_public, self.options.adt_series, jenkins_public, self.options.adt_series,
adtsrc.replace("+", "-")) adtsrc.replace("+", "-"))
private_url = "%s/%s-adt-%s/" % ( 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
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>, "
"<a href=\"%s\">private</a>)" % "<a href=\"%s\">private</a>)" %
(adtsrc, adtver, status, public_url, private_url)) (adtsrc, adtver, adt_label, public_url, private_url))
if status != "PASS": if status not in ADT_PASS:
hints = self.hints.search( hints = self.hints.search(
'force-badtest', package=adtsrc) 'force-badtest', package=adtsrc)
hints.extend( hints.extend(

Loading…
Cancel
Save