[users at bb.net] How to make a step failing from LineConsumerLogObserver

Cipi Bad cipibad at gmail.com
Thu Mar 1 12:57:56 UTC 2018


Sorry,
Full code bellow:

class MyShellCommand(shell.ShellCommand):

    def __init__(self, **kwargs):
        shell.ShellCommand.__init__(self, **kwargs)
        self.addLogObserver('stdio',
logobserver.LineConsumerLogObserver(self.logConsumer))
        self.testFailed = False

    def logConsumer(self):
        while True:
            stream, line = yield
            if line.find('TEST_FAILURE_INDICATOR') != -1:
                self.testFailed = True

                return

    def evaluateCommand(self, cmd):
        res = shell.ShellCommand.evaluateCommand(self, cmd)
        if self.testFailed:
            res = FAIL


On Thu, Mar 1, 2018 at 2:55 PM, Cipi Bad <cipibad at gmail.com> wrote:

> Hi,
>
> Something like bellow should work.
>
> BR,
>
> cipibad
>
> class MyShellCommand(shell.ShellCommand):
>     def logConsumer(self):
>         while True:
>             stream, line = yield
>             if line.find('TEST_FAILURE_INDICATOR') != -1:
>                 self.testFailed = True
>
>                 return
>
>     def evaluateCommand(self, cmd):
>         res = shell.ShellCommand.evaluateCommand(self, cmd)
>         if self.testFailed:
>             res = FAILURE
>         return res
>
>
>
>
> On Thu, Mar 1, 2018 at 2:04 PM, Martin Liška <mliska at suse.cz> wrote:
>
>> Hi.
>>
>> I would consider it handy to run a command and make an output analysis
>> in LineConsumerLogObserver. Doing that I would like to fail a build step,
>> is it somehow possible?
>>
>> Thanks,
>> Martin
>> _______________________________________________
>> users mailing list
>> users at buildbot.net
>> https://lists.buildbot.net/mailman/listinfo/users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20180301/5f373524/attachment.html>


More information about the users mailing list