]> source.dussan.org Git - poi.git/commitdiff
Added ability to debug testcases using jpda, also refactored a bit
authorAvik Sengupta <avik@apache.org>
Mon, 2 Jun 2003 08:03:30 +0000 (08:03 +0000)
committerAvik Sengupta <avik@apache.org>
Mon, 2 Jun 2003 08:03:30 +0000 (08:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353116 13f79535-47bb-0310-9956-ffa450edef68

build.xml

index a6112ce645464e196d8eb75c5ee01b304b50372b..9984a9d874aecb37a63fad8baa6c82f275c6b994 100644 (file)
--- a/build.xml
+++ b/build.xml
         </uptodate>
     </target>
 
-    <target name="test-main" depends="compile-main,-test-main-check" unless="main.test.notRequired">
-        <junit printsummary="yes" showoutput="true" filtertrace="no" fork="no"
-            haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
-            <classpath>
+       <path id="test.classpath">
                 <path refid="main.classpath"/>
                 <pathelement location="${main.output.dir}"/>
                 <pathelement location="${main.output.test.dir}"/>
                 <pathelement location="${junit.jar1.dir}"/>
-            </classpath>
+         </path>
+    <target name="test-main" depends="compile-main,-test-main-check" unless="main.test.notRequired">
+        <junit printsummary="yes" showoutput="true" filtertrace="no" fork="no"
+            haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
+            <classpath refid="test.classpath"/>
             <sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
             <sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
             <formatter type="plain"/>
         <antcall target="-test-main-write-testfile"/>
     </target>
 
-    <target name="single-test" depends="compile-main">
-       <junit printsummary="no" showoutput="true" filtertrace="no" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
-       <classpath>
-                <path refid="main.classpath"/>
-                <pathelement location="${main.output.dir}"/>
-                <pathelement location="${main.output.test.dir}"/>
-                <pathelement location="${junit.jar1.dir}"/>
-            </classpath>
+    <target name="single-test" depends="-test-property-check,compile-main">
+       <junit printsummary="no" showoutput="true" filtertrace="no" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
+            <classpath refid="test.classpath"/>
            <sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
             <sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
             <formatter type="plain" usefile="no"/>
        </junit>
     </target>
 
+    <target name="debug-test" depends="-test-property-check,compile-main">
+       <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
+       <jvmarg value="-Xdebug"/>
+       <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
+       <sysproperty key="java.compiler" value="NONE"/>
+       <classpath refid="test.classpath"/>
+           <sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
+            <sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
+            <formatter type="plain" usefile="no"/>
+           <test name="${testcase}" />
+       </junit>
+    </target>
+
+    <target name="-test-property-check" unless="testcase">
+       <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
+       <fail/>
+    </target>
+
     <target name="-test-main-write-testfile" unless="main.test.failed">
         <echo file="${main.testokfile}" append="false" message="testok"/>
     </target>