ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r382011 - /ant/core/trunk/build.xml
Date Wed, 01 Mar 2006 13:27:02 GMT
Author: stevel
Date: Wed Mar  1 05:27:01 2006
New Revision: 382011

URL: http://svn.apache.org/viewcvs?rev=382011&view=rev
Log:
tweak how tests run
-you get the junit report if  a trax impl is present
-we fail afterwards if a test failed or errored
-commonality of the two junit runs factored out into a presetdef, single point of maintenance.

Modified:
    ant/core/trunk/build.xml

Modified: ant/core/trunk/build.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/build.xml?rev=382011&r1=382010&r2=382011&view=diff
==============================================================================
--- ant/core/trunk/build.xml (original)
+++ ant/core/trunk/build.xml Wed Mar  1 05:27:01 2006
@@ -1585,40 +1585,60 @@
          Run testcase
        ===================================================================
   -->
-  <target name="test" depends="run-tests,run-single-test" description="--> run JUnit
tests"/>
+  <target name="test" depends="test-halt" description="--> run JUnit tests"/>
+
+
+  <target name="test-init" depends="probe-offline">
+
+    <presetdef name="test-junit">
+      <junit printsummary="${junit.summary}"
+          haltonfailure="${test.haltonfailure}"
+          fork="${junit.fork}"
+          failureproperty="tests.failed"
+          errorproperty="tests.failed"
+          filtertrace="${junit.filtertrace}">
+        <!--      <jvmarg value="-classic"/> -->
+        <sysproperty key="ant.home" value="${ant.home}"/>
+        <sysproperty key="build.tests" file="${build.tests}"/>
+        <sysproperty key="build.tests.value" value="${build.tests.value}"/>
+        <sysproperty key="offline" value="${offline}"/>
+        <sysproperty key="tests-classpath.value"
+            value="${tests-classpath.value}"/>
+        <sysproperty key="root" file="${basedir}"/>
+        <sysproperty key="build.compiler" value="${build.compiler}"/>
+        <sysproperty key="tests.and.ant.share.classloader"
+            value="${tests.and.ant.share.classloader}"/>
+        <classpath refid="tests-classpath"/>
+        <formatter type="xml"/>
+      </junit>
+    </presetdef>
+
+  </target>
+<!--if="run.junitreport"-->
+  <target name="test-report" depends="test-init,run-tests,run-single-test"
+      if="trax.impl.present">
+    <junitreport todir="${build.tests}">
+      <fileset dir="${build.tests}">
+        <include name="TEST-*.xml"/>
+      </fileset>
+      <report format="frames" todir="${build.tests}"/>
+    </junitreport>
+  </target>
+
+  <target name="test-halt" depends="test-report" >
+    <fail if="tests.failed">Unit tests failed</fail>
+  </target>
+
+
+  <target name="run-tests" depends="dump-info,compile-tests,probe-offline,test-init"
+      if="junit.present" unless="testcase">
 
-  <target name="run-tests" depends="dump-info,compile-tests,probe-offline" if="junit.present"
unless="testcase">
 
-    <condition property="run.junitreport">
-      <or>
-        <isset property="xalan2.present"/>
-        <and>
-          <isset property="xalan.present"/>
-          <isset property="bsf.present"/>
-        </and>
-      </or>
-    </condition>
 
     <property name="includetests" value="**/*Test*" />
     <property name="excludetests" value="" />
 
-    <junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}"
-      filtertrace="${junit.filtertrace}"
-      fork="${junit.fork}" forkmode="${junit.forkmode}"
-      failureproperty="tests.failed">
-      <!--      <jvmarg value="-classic"/> -->
-      <classpath refid="tests-classpath"/>
-
-      <sysproperty key="ant.home" value="${ant.home}"/>
-      <sysproperty key="build.tests" file="${build.tests}"/>
-      <sysproperty key="offline" value="${offline}"/>
-      <sysproperty key="build.tests.value" value="${build.tests.value}"/>
-      <sysproperty key="tests-classpath.value"
-        value="${tests-classpath.value}"/>
-      <sysproperty key="root" file="${basedir}"/>
-      <sysproperty key="build.compiler" value="${build.compiler}"/>
-      <sysproperty key="tests.and.ant.share.classloader"
-                   value="${tests.and.ant.share.classloader}"/>
+    <test-junit >
       <formatter type="brief" usefile="false"/>
 
       <batchtest>
@@ -1773,36 +1793,19 @@
             if="tests.and.ant.share.classloader"/>
         </fileset>
       </batchtest>
-    </junit>
-    <fail if="tests.failed">At least one test has failed.</fail>
+    </test-junit>
   </target>
 
   <target name="run-single-test" if="testcase" depends="compile-tests,run-single-test-only"
     description="--> runs the single unit test defined in the testcase property"/>
 
   <target name="run-single-test-only" if="testcase"
-    description="--> runs the single unit test defined in the testcase property">
-
-
-    <junit printsummary="${junit.summary}"
-      haltonfailure="${test.haltonfailure}"
-      fork="${junit.fork}"
-      filtertrace="${junit.filtertrace}">
-      <!--      <jvmarg value="-classic"/> -->
-      <sysproperty key="ant.home" value="${ant.home}"/>
-      <sysproperty key="build.tests" file="${build.tests}"/>
-      <sysproperty key="build.tests.value" value="${build.tests.value}"/>
-      <sysproperty key="offline" value="${offline}"/>
-      <sysproperty key="tests-classpath.value"
-        value="${tests-classpath.value}"/>
-      <sysproperty key="root" file="${basedir}"/>
-      <sysproperty key="build.compiler" value="${build.compiler}"/>
-      <sysproperty key="tests.and.ant.share.classloader"
-                   value="${tests.and.ant.share.classloader}"/>
-      <classpath refid="tests-classpath"/>
+    description="--> runs the single unit test defined in the testcase property"
+     depends="test-init">
+    <test-junit >
       <formatter type="plain" usefile="false"/>
       <test name="${testcase}"/>
-    </junit>
+    </test-junit>
   </target>
 
   <target name="interactive-tests" description="--> runs interactive tests"



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


Mime
View raw message