[Buildbot-devel] Patch to detect warnings in Test and Compile steps

Greg Ward gerg.ward+buildbot at gmail.com
Thu Aug 2 01:28:48 UTC 2007


On 8/1/07, Roch Gadsdon <rochg at bakbone.co.uk> wrote:
> Hopefully better late than never, I have posted a revised patch that
> I think takes on board the discussion from last time. There is a new
> intermediate class between ShellCommand and Compile/Test that allows
> for a regular expression to be used to specify what counts as a
> warning. By default this is set to "warning[: ]", but the user can
> override this in their config file when adding a step.

I still think the right regex to use is

  \bwarning\b

.  Any sane compiler output should match that.  And any build command
that emits text that matches that regex is worth checking out, even if
it's not a compiler.

Also, prefixing the regex with ".*" and using match() makes life
harder for people providing their own regex pattern.  Use search()
when checking if a line matches the regex, drop the leading ".*", and
life will be easier.  If someone really truly only wants to match
lines that start with "warning", they can use "^warning".

Finally, I really don't think WarningCountingShellCommand is a good
idea.  What if someone else has provided a different subclass of
ShellCommand that I also need to use?  The strict OO design would be
to implement a WarningCounter class, and have every ShellCommand carry
an instance of WarningCounter around.  The default instance does
nothing; you just have to make it really easy to provide an instance
that actually scans for /\bwarning\b/.

A practical Pythonic design might be simpler than this, e.g. just add
a small checkWarning() method to ShellCommand which does nothing if no
warning pattern was supplied.  It all depends on 1) how complex
checkWarning() is and 2) how likely someone is to want to drop in a
completely different implementation without having to subclass
ShellCommand.  Strict OO design is a bit higher overhead, but it
really has a lot going for it.  (Or maybe I've been hanging around
with Java programmers at work too long. ;-)

Greg




More information about the devel mailing list