ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Siri <as...@printcafe.com>
Subject How to do cleanup with parallel and sequential?
Date Tue, 16 Jul 2002 16:19:37 GMT
I'm still learning Ant and ran into a problem for which I can't see an
obvious (elegant?) solution.

The documentation for the parallel and sequential tasks present the
following example:

<parallel>
  <wlrun ...>
  <sequential>
    <sleep seconds="30"/>
    <junit ...>
    <wlstop/>
  </sequential>
</parallel>

The problem I see with the example above is that if the <junit ...> task
fails then <wlstop/> never gets called which means that <wlrun ...> will
never terminate so the <parallel> (and the rest of the build) never
finishes.  Is this right?  If so, how would one get <wlstop/> to execute no
matter what <junit ...> does (assuming <junit ...> is an atomic task) but
still have the sequential report failure?

An actual build script that exhibits this behavior follows.  Assume that the
<waitfor> task is a server process that doesn't time out, that the <fail>
task is a unit test against the server that failed, and that the <property>
task is what is used to bring down the server.

<project name="mytest" default="test" basedir=".">
	<target name="test">
		<parallel>
			<waitfor maxwait="100" maxwaitunit="hour"> <!--
start the server -->
				<isset property="stop"/>
			</waitfor> 
			<sequential>
				<fail message="Oh no!"/> <!-- failing unit
test -->
				<property name="stop" value="true"/> <!--
stop the server -->
			</sequential>
		</parallel>
	</target>
</project>

The above will hang indefinitely (well, for 100 hours).

Perhaps I'm missing something obvious or there is some built-in task that
handles this sort of thing.  Otherwise, could sequential be tweaked to add
an attribute that would allow it to keep running tasks even if one fails but
still return failure?
 
Any insights or suggestions are appreciated.

-Aaron 

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message