Now using a refined buildbot plugin which counts and separates the different types of URL failures and displays them in the waterfall status box.

- Legacy-Id: 293
This commit is contained in:
Henrik Levkowetz 2007-06-10 17:23:13 +00:00
parent c89000f253
commit 9bb6d08ed2
2 changed files with 22 additions and 17 deletions

View file

@ -9,19 +9,20 @@ except ImportError:
from StringIO import StringIO from StringIO import StringIO
class DjangoTest(ShellCommand): class DjangoTest(ShellCommand):
name = "django test" name = "django-test"
command = ["python", "manage.py", "test"] command = ["python", "manage.py", "test"]
description = ["running django test"] description = ["running django-test"]
descriptionDone = ["django test"] descriptionDone = ["django-test"]
flunkOnFailure = False flunkOnFailure = False
flunkingIssues = ["exception", "failure"] # any pyflakes lines like this cause FAILURE flunkingIssues = ["exception", "failure"] # any pyflakes lines like this cause FAILURE
msgtypes = ("exception", "failure", "skipped", "diffs", "ok") msgtypes = ("exceptions", "failures", "skipped", "diffs", "pass")
def createSummary(self, log): def createSummary(self, log):
summaries = {} summaries = {}
typelist = {} typelist = {}
counts = {} counts = {}
m = None
def count(m): def count(m):
if not m in counts: if not m in counts:
counts[m] = 0 counts[m] = 0
@ -38,27 +39,28 @@ class DjangoTest(ShellCommand):
count(m) count(m)
if re.search("^Fail \d+ ", line): if re.search("^Fail \d+ ", line):
m = "fail_%s" % line.split()[1] m = "fail_%s" % line.split()[1]
typelist["failure"].add(m) typelist["failures"].add(m)
count(m) count(m)
if re.search("^Skipping ", line): if re.search("^Skipping ", line):
m = "skipped" m = "skipped"
typelist["skipped"].add(m) typelist["skipped"].add(m)
count(m) count(m)
if re.search("^Diff: .* ", line): if re.search("^Diff: .*", line):
m = "diff_%s" % line.skip()[1] m = "diff_%s" % line.split()[1]
typelist["diffs"].add(m) typelist["diffs"].add(m)
count(m) count(m)
if re.search("^OK (\d+) ", line): if re.search("^OK \d+ ", line):
m = "pass_%s" % line.split()[1] m = "pass_%s" % line.split()[1]
typelist["pass"].add(m) typelist["pass"].add(m)
count(m) count(m)
if re.search("^Pass (\d+) ", line): if re.search("^Pass \d+ ", line):
m = "pass_%s" % line.split()[1] m = "pass_%s" % line.split()[1]
typelist["pass"].add(m) typelist["pass"].add(m)
count(m) count(m)
if not m in summaries: if m:
summaries[m] = [] if not m in summaries:
summaries[m].append(line) summaries[m] = []
summaries[m].append(line)
self.descriptionDone = self.descriptionDone[:] self.descriptionDone = self.descriptionDone[:]
for type in self.msgtypes: for type in self.msgtypes:
@ -67,14 +69,17 @@ class DjangoTest(ShellCommand):
self.descriptionDone.append("%s=%d" % (msg, counts[msg])) self.descriptionDone.append("%s=%d" % (msg, counts[msg]))
self.addCompleteLog(msg, "".join(summaries[msg])) self.addCompleteLog(msg, "".join(summaries[msg]))
self.setProperty("urltest-%s" % type, sum([counts[msg] for msg in typelist[type]])) self.setProperty("urltest-%s" % type, sum([counts[msg] for msg in typelist[type]]))
self.setProperty("urltest-total", sum(counts.values())) self.setProperty("urltest-total", sum([counts[msg] for msg in counts if msg not in typelist["pass"]]))
def evaluateCommand(self, cmd): def evaluateCommand(self, cmd):
if cmd.rc != 0: if cmd.rc != 0:
return FAILURE return FAILURE
for type in self.flunkingIssues: for type in self.flunkingIssues:
if self.getProperty("urltest-%s" % type): try:
return FAILURE if self.getProperty("urltest-%s" % type):
return FAILURE
except KeyError:
pass
if self.getProperty("urltest-total"): if self.getProperty("urltest-total"):
return WARNINGS return WARNINGS
return SUCCESS return SUCCESS

View file

@ -94,13 +94,13 @@ from buildbot.steps.source import SVN
from buildbot.steps.dummy import Dummy from buildbot.steps.dummy import Dummy
from buildbot.steps.python import PyFlakes from buildbot.steps.python import PyFlakes
from buildbot.steps.shell import ShellCommand, Test from buildbot.steps.shell import ShellCommand, Test
from buildbot_plugins import UrlTest from buildbot_plugins import DjangoTest
f1 = factory.BuildFactory() f1 = factory.BuildFactory()
f1.addStep(SVN, svnurl="http://svn.tools.ietf.org/svn/tools/ietfdb/trunk/", username="buildbot@tools.ietf.org", password="U64#GUxr") f1.addStep(SVN, svnurl="http://svn.tools.ietf.org/svn/tools/ietfdb/trunk/", username="buildbot@tools.ietf.org", password="U64#GUxr")
f1.addStep(ShellCommand, name="test-setup", command=["test/test-setup"]) f1.addStep(ShellCommand, name="test-setup", command=["test/test-setup"])
f1.addStep(PyFlakes, command=["test/run-pyflakes", "ietf"], warnOnFailure=True) f1.addStep(PyFlakes, command=["test/run-pyflakes", "ietf"], warnOnFailure=True)
f1.addStep(Test, name="django-tests", command=["python", "ietf/manage.py", "test"], env={'PYTHONPATH': ["test/lib",]} ) f1.addStep(DjangoTest, command=["python", "ietf/manage.py", "test"], env={'PYTHONPATH': ["test/lib",]} )
f1.addStep(ShellCommand, name="test-teardown", command=["test/test-teardown"]) f1.addStep(ShellCommand, name="test-teardown", command=["test/test-teardown"])
b1 = {'name': "merlot-builder-1", b1 = {'name': "merlot-builder-1",