logo       

Re: running a command if another fails?: msg#00000

python.buildbot.devel

Subject: Re: running a command if another fails?

Hi,

> What's the best way to do this? I thought of running "make check ||
> cat testsuite.log", but is there a better way?

It probably is the better (read: easiest) way. I don't particularly
like it either, but it's a lot less code.

Having said that, I use some steps that do something similar to what you
want. First step is an incremental make, which just runs make. The
second step is a step that only runs if the first one fails, and runs
autogen in that case. Third one is another make, and only runs if the
first one failed.

This is done by having the "conditional" steps peek one or more steps up
for the results. So this only works if the conditional step can rely on
the step it's looking for to be exactly there (ie, inserting a step
later on will screw up your build).

here is the autogen one:

class AutogenAfterIncMake(Autogen):
def start(self, errorMessage=None):
previousResult = self.build.results[-1]
# if the inc make succeeded, we don't need to autogen
if previousResult == SUCCESS:
return SKIPPED
# otherwise, do what we would normally do
return step.ShellCommand.start(self, errorMessage)

Hope that helps,
Thomas


Dave/Dina : future TV today ! - http://www.davedina.org/
<-*- thomas (dot) apestaart (dot) org -*->
I'd like to tell you how I feel
I'll probably keep it till a Saturday
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.fm/





-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise