You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jh...@apache.org on 2007/09/11 13:41:41 UTC

svn commit: r574557 - /ant/core/trunk/build.xml

Author: jhm
Date: Tue Sep 11 04:41:40 2007
New Revision: 574557

URL: http://svn.apache.org/viewvc?rev=574557&view=rev
Log:
Make use of the FailureRecorder
- ${junit.collector.dir} references ${build.dir} therefore a change of the order was necessary
- makro "test-junit" uses the recorder like the manual sais
- invocation of batchtest is now dependend on ${hasFailingTests} (set by <test-junit>)

Modified:
    ant/core/trunk/build.xml

Modified: ant/core/trunk/build.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/build.xml?rev=574557&r1=574556&r2=574557&view=diff
==============================================================================
--- ant/core/trunk/build.xml (original)
+++ ant/core/trunk/build.xml Tue Sep 11 04:41:40 2007
@@ -56,25 +56,6 @@
 
   <!--
        ===================================================================
-         Set the properties that control various build options
-       ===================================================================
-  -->
-  <property name="debug" value="true"/>
-  <property name="chmod.fail" value="true"/>
-  <property name="chmod.maxparallel" value="250"/>
-  <property name="deprecation" value="false"/>
-  <property name="optimize" value="true"/>
-  <property name="javac.target" value="1.2"/>
-  <property name="javac.source" value="1.2"/>
-  <property name="junit.fork" value="false"/>
-  <property name="junit.filtertrace" value="off"/>
-  <property name="junit.summary" value="no"/>
-  <property name="test.haltonfailure" value="false"/>
-  <property name="junit.forkmode" value="once"/>
-  <property name="unfiltered.files" value="**/*.gif,**/*.jpg,**/*.ico,**/*.pdf,**/*.zip"/>
-
-  <!--
-       ===================================================================
          Set the properties related to the source tree
        ===================================================================
   -->
@@ -112,6 +93,27 @@
 
   <!--
        ===================================================================
+         Set the properties that control various build options
+       ===================================================================
+  -->
+  <property name="debug" value="true"/>
+  <property name="chmod.fail" value="true"/>
+  <property name="chmod.maxparallel" value="250"/>
+  <property name="deprecation" value="false"/>
+  <property name="optimize" value="true"/>
+  <property name="javac.target" value="1.2"/>
+  <property name="javac.source" value="1.2"/>
+  <property name="junit.fork" value="false"/>
+  <property name="junit.filtertrace" value="off"/>
+  <property name="junit.summary" value="no"/>
+  <property name="test.haltonfailure" value="false"/>
+  <property name="junit.forkmode" value="once"/>
+  <property name="unfiltered.files" value="**/*.gif,**/*.jpg,**/*.ico,**/*.pdf,**/*.zip"/>
+  <property name="junit.collector.dir" value="${build.dir}/failingTests"/>
+  <property name="junit.collector.class" value="FailedTests"/>
+
+  <!--
+       ===================================================================
          Set the paths used in the build
        ===================================================================
   -->
@@ -1641,6 +1643,21 @@
     <macrodef name="test-junit">
       <element name="junit-nested" implicit="true" />
       <sequential>
+        <!-- Delete 'old' collector classes -->
+        <delete failonerror="false">
+          <fileset dir="${junit.collector.dir}" includes="${junit.collector.class}*.class"/>
+        </delete>
+        <!-- compile the FailedTests class if present -->
+        <mkdir dir="${junit.collector.dir}"/>
+        <javac srcdir="${junit.collector.dir}" destdir="${junit.collector.dir}">
+          <classpath id="failure.cp">
+            <pathelement location="${build.classes}"/>
+            <pathelement location="${build.tests}"/>
+          </classpath>
+        </javac>
+        <available file="${junit.collector.dir}/${junit.collector.class}.class"
+                   property="hasFailingTests"/>
+        <!-- run the tests -->
         <mkdir dir="${build.junit.xml}" />
         <property name="test.junit.vmargs" value=""/>
         <junit printsummary="${junit.summary}"
@@ -1660,9 +1677,18 @@
           <sysproperty key="build.compiler" value="${build.compiler}"/>
           <sysproperty key="tests.and.ant.share.classloader"
                        value="${tests.and.ant.share.classloader}"/>
-          <classpath refid="tests-classpath"/>
+          <sysproperty key="ant.junit.failureCollector"
+                       value="${junit.collector.dir}/${junit.collector.class}"/>
+          <classpath>
+            <path refid="tests-classpath"/>
+            <pathelement location="${junit.collector.dir}"/>
+            <path refid="failure.cp"/>
+          </classpath>
+          <formatter type="failure" usefile="false"/>
           <formatter type="xml"/>
           <jvmarg line="${test.junit.vmargs}"/>
+          <test name="${junit.collector.class}" if="hasFailingTests"/>
+          
           <junit-nested />
         </junit>
       </sequential>
@@ -1770,7 +1796,7 @@
     <test-junit>
       <formatter type="brief" usefile="false"/>
 
-      <batchtest todir="${build.junit.xml}">
+      <batchtest todir="${build.junit.xml}" unless="hasFailingTests">
         <fileset dir="${src.junit}"
                  includes="${junit.includes}" excludes="${junit.excludes}">
 



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