master/buildbot/steps/maxq.py
author ffxbld
Thu, 08 Jan 2015 23:25:35 -0500
branchproduction-0.8
changeset 1221 3d67bdd68e436955cba59a437572dbf3e251fe33
parent 78 42babfd9ed35458f5acc07b4a0302f6b42304c71
child 139 6cf864606526c53c6d68a4ee3d4b1aec5db2c204
permissions -rw-r--r--
Added FIREFOX_35_0_RELEASE FIREFOX_35_0_BUILD3 tag(s) for changeset production-0.8. DONTBUILD CLOSED TREE a=release

from buildbot.steps.shell import ShellCommand
from buildbot.status.builder import Event, SUCCESS, FAILURE

class MaxQ(ShellCommand):
    flunkOnFailure = True
    name = "maxq"

    def __init__(self, testdir=None, **kwargs):
        if not testdir:
            raise TypeError("please pass testdir")
        kwargs['command'] = 'run_maxq.py %s' % (testdir,)
        ShellCommand.__init__(self, **kwargs)
        self.addFactoryArguments(testdir=testdir)

    def startStatus(self):
        evt = Event("yellow", ['running', 'maxq', 'tests'],
                    files={'log': self.log})
        self.setCurrentActivity(evt)


    def finished(self, rc):
        self.failures = 0
        if rc:
            self.failures = 1
        output = self.log.getAll()
        self.failures += output.count('\nTEST FAILURE:')

        result = (SUCCESS, ['maxq'])

        if self.failures:
            result = (FAILURE, [str(self.failures), 'maxq', 'failures'])

        return self.stepComplete(result)

    def finishStatus(self, result):
        if self.failures:
            text = ["maxq", "failed"]
        else:
            text = ['maxq', 'tests']
        self.updateCurrentActivity(text=text)
        self.finishStatusSummary()
        self.finishCurrentActivity()