test_config.py: make sure we can round-trip all of our current step classes
[buildbot.git] / buildbot / steps / maxq.py
blob2a29ed86add03f2a9bcc45514b98d53b069fda25
1 from buildbot.steps.shell import ShellCommand
2 from buildbot.status.builder import Event, SUCCESS, FAILURE
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 kwargs['command'] = 'run_maxq.py %s' % (testdir,)
12 ShellCommand.__init__(self, **kwargs)
13 self.addFactoryArguments(testdir=testdir)
15 def startStatus(self):
16 evt = Event("yellow", ['running', 'maxq', 'tests'],
17 files={'log': self.log})
18 self.setCurrentActivity(evt)
21 def finished(self, rc):
22 self.failures = 0
23 if rc:
24 self.failures = 1
25 output = self.log.getAll()
26 self.failures += output.count('\nTEST FAILURE:')
28 result = (SUCCESS, ['maxq'])
30 if self.failures:
31 result = (FAILURE, [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()