add task "test-deprecated" to run deprecated test cases.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150695 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bernhard Messer 2004-12-05 18:24:35 +00:00
parent c0b059bf97
commit a48937b2c5
1 changed files with 81 additions and 15 deletions

View File

@ -59,6 +59,12 @@
<pathelement location="${build.dir}/classes/test"/> <pathelement location="${build.dir}/classes/test"/>
</path> </path>
<!-- classpath for deprecated test cases, should be removed when moving from 1.9 to 2.0 -->
<path id="test-deprecated.classpath">
<path refid="demo.classpath"/>
<pathelement location="${build.dir}/classes/test-deprecated"/>
</path>
<path id="junit.classpath"> <path id="junit.classpath">
<pathelement location="${build.dir}/classes/test"/> <pathelement location="${build.dir}/classes/test"/>
<pathelement location="${build.dir}/classes/java"/> <pathelement location="${build.dir}/classes/java"/>
@ -69,6 +75,17 @@
<pathelement path="${java.class.path}"/> <pathelement path="${java.class.path}"/>
</path> </path>
<!-- junit classpath for deprecated test cases, should be removed when moving from 1.9 to 2.0 -->
<path id="junit-deprecated.classpath">
<pathelement location="${build.dir}/classes/test-deprecated"/>
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/demo"/>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<path id="anakia.classpath"> <path id="anakia.classpath">
<fileset dir="${jakarta.site2.home}/lib"> <fileset dir="${jakarta.site2.home}/lib">
<include name="*.jar"/> <include name="*.jar"/>
@ -226,28 +243,28 @@
<!-- ================================================================== --> <!-- ================================================================== -->
<!-- B U I L D T E S T --> <!-- B U I L D D E P R E C A T E D T E S T -->
<!-- ================================================================== --> <!-- ================================================================== -->
<!-- --> <!-- should be removed when moving from lucene 1.9 to 2.0 -->
<!-- ================================================================== --> <!-- ================================================================== -->
<target name="compile-test" depends="compile-core,compile-demo"> <target name="compile-test-deprecated" depends="compile-core,compile-demo">
<mkdir dir="${build.dir}/classes/test"/> <mkdir dir="${build.dir}/classes/test-deprecated"/>
<javac <javac
encoding="${build.encoding}" encoding="${build.encoding}"
srcdir="src/test" srcdir="src/test-deprecated"
includes="**/*.java" includes="**/*.java"
destdir="${build.dir}/classes/test" destdir="${build.dir}/classes/test-deprecated"
debug="true"> debug="true">
<classpath refid="test.classpath"/> <classpath refid="test-deprecated.classpath"/>
</javac> </javac>
</target> </target>
<!-- ================================================================== --> <!-- ================================================================== -->
<!-- R U N T E S T S --> <!-- R U N D E P R E C A T E D T E S T S -->
<!-- ================================================================== --> <!-- ================================================================== -->
<!-- --> <!-- should be removed when moving from lucene 1.9 to 2.0 -->
<!-- ================================================================== --> <!-- ================================================================== -->
<target name="test" depends="compile-test" description="Runs unit tests"> <target name="test-deprecated" depends="compile-test-deprecated" description="Runs deprecated unit tests">
<fail unless="junit.present"> <fail unless="junit.present">
################################################################## ##################################################################
JUnit not found. JUnit not found.
@ -258,22 +275,71 @@
<mkdir dir="${junit.output.dir}"/> <mkdir dir="${junit.output.dir}"/>
<junit printsummary="off" haltonfailure="no" <junit printsummary="off" haltonfailure="no"
errorProperty="tests.failed" failureProperty="tests.failed"> errorProperty="tests.failed" failureProperty="tests.failed">
<classpath refid="junit.classpath"/> <classpath refid="junit-deprecated.classpath"/>
<sysproperty key="dataDir" file="src/test"/> <sysproperty key="dataDir" file="src/test-deprecated"/>
<sysproperty key="tempDir" file="${build.dir}/test"/> <sysproperty key="tempDir" file="${build.dir}/test-deprecated"/>
<formatter type="xml"/> <formatter type="xml"/>
<formatter type="brief" usefile="false"/> <formatter type="brief" usefile="false"/>
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase"> <batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test" includes="**/Test*.java"/> <fileset dir="src/test-deprecated" includes="**/Test*.java"/>
</batchtest> </batchtest>
<batchtest fork="yes" todir="${junit.output.dir}" if="testcase"> <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
<fileset dir="src/test" includes="**/${testcase}.java"/> <fileset dir="src/test-deprecated" includes="**/${testcase}.java"/>
</batchtest> </batchtest>
</junit> </junit>
<fail if="tests.failed">Tests failed!</fail> <fail if="tests.failed">Tests failed!</fail>
</target> </target>
<!-- ================================================================== -->
<!-- B U I L D T E S T -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="compile-test" depends="compile-core,compile-demo">
<mkdir dir="${build.dir}/classes/test"/>
<javac
encoding="${build.encoding}"
srcdir="src/test"
includes="**/*.java"
destdir="${build.dir}/classes/test"
debug="true">
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- R U N T E S T S -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="test" depends="compile-test" description="Runs unit tests">
<fail unless="junit.present">
##################################################################
JUnit not found.
Please make sure junit.jar is in ANT_HOME/lib, or made available
to Ant using other mechanisms like -lib or CLASSPATH.
##################################################################
</fail>
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="off" haltonfailure="no"
errorProperty="tests.failed" failureProperty="tests.failed">
<classpath refid="junit.classpath"/>
<sysproperty key="dataDir" file="src/test"/>
<sysproperty key="tempDir" file="${build.dir}/test"/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test" includes="**/Test*.java"/>
</batchtest>
<batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
<fileset dir="src/test" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<!-- backwards compatible target - may be removed --> <!-- backwards compatible target - may be removed -->
<target name="test-unit" depends="test"/> <target name="test-unit" depends="test"/>