Added ability to debug testcases using jpda, also refactored a bit

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Avik Sengupta 2003-06-02 08:03:30 +00:00
parent 4c6dedf2fb
commit 0e21588438

View File

@ -215,15 +215,16 @@
</uptodate> </uptodate>
</target> </target>
<target name="test-main" depends="compile-main,-test-main-check" unless="main.test.notRequired"> <path id="test.classpath">
<junit printsummary="yes" showoutput="true" filtertrace="no" fork="no"
haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
<classpath>
<path refid="main.classpath"/> <path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/> <pathelement location="${main.output.dir}"/>
<pathelement location="${main.output.test.dir}"/> <pathelement location="${main.output.test.dir}"/>
<pathelement location="${junit.jar1.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="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"/> <sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
<formatter type="plain"/> <formatter type="plain"/>
@ -239,14 +240,9 @@
<antcall target="-test-main-write-testfile"/> <antcall target="-test-main-write-testfile"/>
</target> </target>
<target name="single-test" depends="compile-main"> <target name="single-test" depends="-test-property-check,compile-main">
<junit printsummary="no" showoutput="true" filtertrace="no" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" > <junit printsummary="no" showoutput="true" filtertrace="no" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
<classpath> <classpath refid="test.classpath"/>
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${junit.jar1.dir}"/>
</classpath>
<sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/> <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"/> <sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
<formatter type="plain" usefile="no"/> <formatter type="plain" usefile="no"/>
@ -255,6 +251,24 @@
</junit> </junit>
</target> </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"> <target name="-test-main-write-testfile" unless="main.test.failed">
<echo file="${main.testokfile}" append="false" message="testok"/> <echo file="${main.testokfile}" append="false" message="testok"/>
</target> </target>