move more BuildSteps into buildbot/steps/: step_twisted.py and maxq
[buildbot.git] / buildbot / steps / maxq.py
blob6ade4426baeb0660048fbdb624ac0d44452acae1
1 from buildbot.steps.shell import ShellCommand
2 from buildbot.status import event, builder
4 class MaxQ(ShellCommand):
5 flunkOnFailure = True
6 name = "maxq"
8 def __init__(self, testdir=None, **kwargs):
9 if not testdir:
10 raise TypeError("please pass testdir")
11 command = 'run_maxq.py %s' % (testdir,)
12 ShellCommand.__init__(self, command=command, **kwargs)
14 def startStatus(self):
15 evt = event.Event("yellow", ['running', 'maxq', 'tests'],
16 files={'log': self.log})
17 self.setCurrentActivity(evt)
20 def finished(self, rc):
21 self.failures = 0
22 if rc:
23 self.failures = 1
24 output = self.log.getAll()
25 self.failures += output.count('\nTEST FAILURE:')
27 result = (builder.SUCCESS, ['maxq'])
29 if self.failures:
30 result = (builder.FAILURE,
31 [str(self.failures), 'maxq', 'failures'])
33 return self.stepComplete(result)
35 def finishStatus(self, result):
36 if self.failures:
37 color = "red"
38 text = ["maxq", "failed"]
39 else:
40 color = "green"
41 text = ['maxq', 'tests']
42 self.updateCurrentActivity(color=color, text=text)
43 self.finishStatusSummary()
44 self.finishCurrentActivity()