ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Smith <dlsm...@rice.edu>
Subject Repeating a task x times
Date Tue, 15 Aug 2006 18:26:49 GMT
I'm interested in writing a script that repeats some task a user- 
specified number of times.  This is useful where the behavior of  
JUnit tests is randomized (explicitly or, in this case, due to  
concurrency irregularities), and a test sample of size larger than 1  
is needed.

The best solution we've been able to come up with is the "for" task  
from ant-contrib.  Unfortunately, "for" iterates over lists (or  
tokenized strings), not numbers.  So we can do something like this:

 > ant -Drepeat="1,2,3" sometarget

<target name="sometarget">
    <for list="${repeat}>
       (do something)
    </for>
</target>

Clearly, this isn't ideal.  I might explore doing something with the  
"math" task in ant-contrib.  What other recommendations do you have?

—Dan


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


Mime
View raw message