[Buildbot-devel] _pendingLogObservers
Benoît Allard
benoit at aeteurope.nl
Mon Jul 26 08:20:04 UTC 2010
John Wieland wrote:
> Hi All,
>
> I am using Buildbot 0.8.0 and have followed the example in the most
> recent version of the documentation about writing custom build steps to
> create a BuildStep similar to the Framboozle build step. Here is my code:
>
> import re
> from buildbot.steps import shell
> from buildbot.process.buildstep import LogLineObserver
>
>
> class R_TestParser(LogLineObserver):
> total_tests = 0
> pass_tests = 0
> fail_tests = 0
> skip_tests = 0
> current_test = ""
>
> def __init__(self)
> LogLineObserver.__init__(self)
>
> def outLineReceived(self, line):
> if "TEST_EXE:BEGIN" in line:
> # Get the test name
> re.search('TEST_EXE:BEGIN:(.*)--#', line)
> current_test = re.group(0)
>
> self.numTests += 1
> self.step.setProgress('tests', self.numTests)
> elif "TEST:SUCCESS" in line:
> pass_tests += 1
> print "Pass tests" + pass_tests
> elif "TEST:FAIL" in line:
> fail_tests += 1
> elif "TEST:SKIP" in line:
> skip_tests += 1
> elif "TEST_EXE:END" in line:
> self.numTests += 1
>
> class R_TestStep(shell.ShellCommand):
> command = ['sh', 'buildrmt.sh']
>
> def __init__(self, **kwargs):
> ShellCommand.__init__(self, **kwargs)
> observer = R_TestParser()
> self.addLogObserver('stdio', observer)
> self.progressMetrics += ('tests',)
>
> When attempting to reconfigure the build master I get the following:
> File
> "/usr/local/lib/python2.6/dist-packages/buildbot/process/buildstep.py",
> line 939, in addLogObserver
> self._pendingLogObservers.append((logname, observer))
> exceptions.AttributeError: R_TestStep instance has no attribute
> '_pendi
> ngLogObservers'
>
> 2010-07-24 08:53:49+1000 [-] The new config file is unusable, so I'll
> ignore it.
I guess you're doing all right, except that the __init__ method is not
the place to add your logobserver, as at this time, (almost) nothing is
ready yet.
What I can see from the source of the visualstudio steps [1] is that you
should overwrite a method called "setupLogfiles" to setup your logobserver.
Hope this helps.
Regards,
Benoit
[1]
http://github.com/djmitche/buildbot/blob/master/master/buildbot/steps/vstudio.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6031 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://buildbot.net/pipermail/devel/attachments/20100726/670c499a/attachment.bin>
More information about the devel
mailing list