Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml	(revision 1616986)
+++ lucene/common-build.xml	(working copy)
@@ -1289,8 +1289,8 @@
 
   <!-- note: order here is important, the taskdef depends on test-framework
        jars so we just order it after compile-test to ensure that -->
-  <target name="test" depends="clover,compile-test,install-junit4-taskdef,validate,-init-totals,-test,-check-totals" description="Runs unit tests">
-  </target>
+  <target name="test" depends="clover,compile-test,install-junit4-taskdef,validate,-init-totals,-test,-check-totals" description="Runs unit tests"/>
+  <target name="beast-test" depends="clover,compile-test,install-junit4-taskdef,validate,-init-totals,-beast-test,-check-totals" description="Runs unit tests in a loop (-Dbeast.iters=n)"/>
 
   <!-- Run the actual tests (must be wrapped with -init-totals, -check-totals) -->
   <target name="-test">
@@ -1298,6 +1298,23 @@
     <test-macro threadNum="${tests.jvms.override}" />
   </target>
 
+  <!-- Beast the actual tests (must be wrapped with -init-totals, -check-totals) -->
+  <target name="-beast-test" depends="resolve-groovy">
+    <groovy taskname="beaster"><![CDATA[
+      int iters = Integer.parseInt(properties['beast.iters'] ?: '1');
+      (1..iters).each({ i ->
+        task.log('Start round: ' + i);
+        def t = project.createTask('antcall');
+        t.setTarget('-test');
+        t.setInheritAll(true);
+        t.setInheritRefs(true);
+        t.execute();
+        task.log('End round: ' + i);
+      });
+      task.log('Beasting finished.');
+    ]]></groovy>
+  </target>
+
   <target name="-check-totals" if="tests.totals.toplevel" depends="resolve-groovy">
     <!-- We are concluding a test pass at the outermost level. Sum up all executed tests. -->
     <groovy><![CDATA[
@@ -1315,7 +1332,7 @@
       }
 
       // Interesting but let's keep the build output quiet.
-      // project.log("Grand total of all executed tests (including sub-modules): " + total);
+      // task.log("Grand total of all executed tests (including sub-modules): " + total);
     ]]></groovy>
   </target>
 

