move task definition inside testmacro to not fail build if ant-junit is not installed
authorMarcus Eriksson <marcuse@apache.org>
Thu, 29 Nov 2018 07:53:19 +0000 (08:53 +0100)
committerMarcus Eriksson <marcuse@apache.org>
Thu, 20 Dec 2018 12:38:28 +0000 (13:38 +0100)
Patch by marcuse; reviewed by Jon Meredith for CASSANDRA-14915

build.xml

index d7e6c4b..7e85991 100644 (file)
--- a/build.xml
+++ b/build.xml
       </rat:report>
     </target>
 
-    <!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
-  <taskdef name="junit" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
   <target name="build-test" depends="build" description="Compile test classes">
     <javac
      debug="true"
                  else="">
         <istrue value="${usejacoco}"/>
       </condition>
+      <!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
+      <taskdef name="junit-timeout" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
       <mkdir dir="${build.test.dir}/cassandra"/>
       <mkdir dir="${build.test.dir}/output"/>
       <mkdir dir="${build.test.dir}/output/@{testtag}"/>
-      <junit fork="on" forkmode="@{forkmode}" failureproperty="testfailed" maxmemory="1024m" timeout="@{timeout}">
+      <junit-timeout fork="on" forkmode="@{forkmode}" failureproperty="testfailed" maxmemory="1024m" timeout="@{timeout}">
         <formatter classname="org.apache.cassandra.CassandraXMLJUnitResultFormatter" extension=".xml" usefile="true"/>
         <formatter classname="org.apache.cassandra.CassandraBriefJUnitResultFormatter" usefile="false"/>
         <jvmarg value="-Dstorage-config=${test.conf}"/>
             <fileset dir="@{inputdir}" includes="@{filter}" excludes="@{exclude}"/>
             <filelist dir="@{inputdir}" files="@{filelist}"/>
         </batchtest>
-      </junit>
+      </junit-timeout>
       <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/commitlog:@{poffset}"/>
       <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/data:@{poffset}"/>
       <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/saved_caches:@{poffset}"/>