| OLD | NEW |
| (Empty) |
| 1 from buildbot.steps.shell import ShellCommand | |
| 2 from buildbot.status.builder import Event, SUCCESS, FAILURE | |
| 3 | |
| 4 class MaxQ(ShellCommand): | |
| 5 flunkOnFailure = True | |
| 6 name = "maxq" | |
| 7 | |
| 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) | |
| 14 | |
| 15 def startStatus(self): | |
| 16 evt = Event("yellow", ['running', 'maxq', 'tests'], | |
| 17 files={'log': self.log}) | |
| 18 self.setCurrentActivity(evt) | |
| 19 | |
| 20 | |
| 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:') | |
| 27 | |
| 28 result = (SUCCESS, ['maxq']) | |
| 29 | |
| 30 if self.failures: | |
| 31 result = (FAILURE, [str(self.failures), 'maxq', 'failures']) | |
| 32 | |
| 33 return self.stepComplete(result) | |
| 34 | |
| 35 def finishStatus(self, result): | |
| 36 if self.failures: | |
| 37 text = ["maxq", "failed"] | |
| 38 else: | |
| 39 text = ['maxq', 'tests'] | |
| 40 self.updateCurrentActivity(text=text) | |
| 41 self.finishStatusSummary() | |
| 42 self.finishCurrentActivity() | |
| 43 | |
| 44 | |
| OLD | NEW |