lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r712416 - in /lucene/java/trunk: CHANGES.txt build.xml common-build.xml
Date Sat, 08 Nov 2008 18:30:38 GMT
Author: buschmi
Date: Sat Nov  8 10:30:37 2008
New Revision: 712416

URL: http://svn.apache.org/viewvc?rev=712416&view=rev
Log:
LUCENE-1440: Add new targets to build.xml that allow downloading and executing the junit testcases
from an older release for backwards-compatibility testing.

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/build.xml
    lucene/java/trunk/common-build.xml

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=712416&r1=712415&r2=712416&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Nov  8 10:30:37 2008
@@ -62,6 +62,10 @@
 
 Build
 
+ 1. LUCENE-1440: Add new targets to build.xml that allow downloading
+    and executing the junit testcases from an older release for
+    backwards-compatibility testing. (Michael Busch)
+
 Test Cases
 
 ======================= Release 2.4.0 2008-10-06 =======================

Modified: lucene/java/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/build.xml?rev=712416&r1=712415&r2=712416&view=diff
==============================================================================
--- lucene/java/trunk/build.xml (original)
+++ lucene/java/trunk/build.xml Sat Nov  8 10:30:37 2008
@@ -88,7 +88,51 @@
   <target name="test" depends="test-core, test-contrib"
           description="Runs all unit tests (including contribs)"
   />
-  
+
+  <property name="tag" value="lucene_2_4_0"/>
+	
+  <path id="tag.test.classpath">
+    <path refid="demo.classpath"/>
+    <path refid="junit-path"/>
+    <pathelement location="${build.dir}/${tag}/classes/test"/>
+  </path>
+	
+  <path id="tag.junit.classpath">
+    <path refid="junit-path"/>
+    <pathelement location="${build.dir}/${tag}/classes/test"/>
+    <pathelement location="${build.dir}/classes/java"/>
+    <pathelement location="${build.dir}/classes/demo"/>
+    <pathelement path="${java.class.path}"/>
+  </path>
+
+  <target name="download-tag"
+  	description="Downloads a previous Lucene version. Specify tag version like this: -Dtag=lucene_2_4_0">
+	<sequential>
+	  <mkdir dir="${tags.dir}/${tag}"/>
+      <exec dir="${tags.dir}/${tag}" executable="svn"
+            failifexecutionfails="true">
+        <arg line="checkout http://svn.apache.org/repos/asf/lucene/java/tags/${tag}/src/test/"/>
+      </exec>
+	</sequential>
+  </target>
+	
+  <target name="test-tag" depends="download-tag, compile-core, compile-demo"
+  	description="Runs tests of a previous Lucene version. Specify tag version like this: -Dtag=lucene_2_4_0">
+	<sequential>
+	  <mkdir dir="${build.dir}/${tag}/test"/>
+	  <compile-test-macro srcdir="${tags.dir}/${tag}/test" destdir="${build.dir}/${tag}/classes/test"
+		  				  test.classpath="tag.test.classpath"/>
+      <test-macro dataDir="${tags.dir}/${tag}/test" 
+      			  tempDir="${build.dir}/${tag}"
+      			  junit.classpath="tag.junit.classpath"/>
+  	</sequential>
+  </target>	
+
+  <target name="clean-tags"
+    description="Removes contents of the tags directory">
+    <delete dir="${tags.dir}"/>
+  </target>
+	
   <!-- ================================================================== -->
   <!-- J A R                                                              -->
   <!-- ================================================================== -->

Modified: lucene/java/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/common-build.xml?rev=712416&r1=712415&r2=712416&view=diff
==============================================================================
--- lucene/java/trunk/common-build.xml (original)
+++ lucene/java/trunk/common-build.xml Sat Nov  8 10:30:37 2008
@@ -73,6 +73,7 @@
 
   <property name="src.dir" location="src/java"/>
   <property name="build.dir" location="build"/>
+  <property name="tags.dir" location="tags"/>
   <property name="dist.dir" location="dist"/>
   <property name="maven.dist.dir" location="dist/maven"/>
   <property name="m2.repository.url" value="file://${maven.dist.dir}"/>
@@ -331,67 +332,92 @@
   </macrodef>
 
   <target name="compile-test" depends="compile-core">
-    <compile
-      srcdir="src/test"
-      destdir="${build.dir}/classes/test">
-      <classpath refid="test.classpath"/>
-    </compile>
-
-    <!-- Copy any data files present to the classpath -->
-    <copy todir="${build.dir}/classes/test">
-      <fileset dir="src/test" excludes="**/*.java"/>
-    </copy>
+  	<compile-test-macro srcdir="src/test" destdir="${build.dir}/classes/test"
+  						test.classpath="test.classpath"/>
   </target>
 
   <property name="tests.verbose" value="false"/>
-
+	
+  <macrodef name="compile-test-macro" description="Compiles junit tests.">
+  	<attribute name="srcdir"/>
+  	<attribute name="destdir"/>
+  	<attribute name="test.classpath"/>
+   	<sequential>
+      <compile
+        srcdir="@{srcdir}" 
+        destdir="@{destdir}">
+        <classpath refid="@{test.classpath}"/>
+      </compile>
+
+      <!-- Copy any data files present to the classpath -->
+      <copy todir="@{destdir}">
+        <fileset dir="@{srcdir}" excludes="**/*.java"/>
+      </copy>
+  	</sequential>
+  </macrodef>
+	
+  <macrodef name="test-macro" description="Executes junit tests.">
+  	<attribute name="junit.output.dir" default="${junit.output.dir}"/>
+  	<attribute name="junit.classpath" default="junit.classpath"/>
+  	<attribute name="dataDir"/>
+  	<attribute name="tempDir"/>
+  	<element name="contrib-settings" optional="yes"/>
+  	
+  	<sequential>
+	  	<mkdir dir="@{junit.output.dir}"/>
+	    <junit printsummary="off" haltonfailure="no" maxmemory="512M"
+	      errorProperty="tests.failed" failureProperty="tests.failed">
+	      <classpath refid="@{junit.classpath}"/>
+	      <assertions>
+	        <enable package="org.apache.lucene"/>
+	      </assertions>
+	
+	      <!-- allow tests to control debug prints -->
+	      <sysproperty key="tests.verbose" value="${tests.verbose}"/>
+	
+	      <!-- TODO: create propertyset for test properties, so each project can have its
own set -->
+	      <sysproperty key="dataDir" file="@{dataDir}"/>
+	      <sysproperty key="tempDir" file="@{tempDir}"/>
+	      <sysproperty key="java.io.tmpdir" file="@{tempDir}"/>
+	
+		  <contrib-settings />
+	    	
+	      <formatter type="xml"/>
+	      <formatter type="brief" usefile="false"/>
+	      <batchtest fork="yes" todir="@{junit.output.dir}" unless="testcase">
+	        <fileset dir="@{dataDir}" includes="${junit.includes}" excludes="${junit.excludes}"/>
+	      </batchtest>
+	      <batchtest fork="yes" todir="@{junit.output.dir}" if="testcase">
+	        <fileset dir="@{dataDir}" includes="**/${testcase}.java"/>
+	      </batchtest>
+	    </junit>
+	    <!-- create this file, then if we don't fail, delete it -->
+	    <!-- this meme makes it easy to tell if contribs have failed later -->
+	    <echo file="@{junit.output.dir}/junitfailed.flag">MAYBE</echo>
+	    <fail if="tests.failed">Tests failed!</fail>
+	    <!-- life would be easier if echo had an 'if' attribute like fail -->
+	    <delete file="@{junit.output.dir}/junitfailed.flag" />
+  	</sequential>
+  </macrodef>
+	
   <target name="test" depends="compile-test" description="Runs unit tests">
-    <mkdir dir="${junit.output.dir}"/>
-    <junit printsummary="off" haltonfailure="no" maxmemory="512M"
-      errorProperty="tests.failed" failureProperty="tests.failed">
-      <classpath refid="junit.classpath"/>
-      <assertions>
-        <enable package="org.apache.lucene"/>
-      </assertions>
-
-      <!-- allow tests to control debug prints -->
-      <sysproperty key="tests.verbose" value="${tests.verbose}"/>
-
-      <!-- TODO: create propertyset for test properties, so each project can have its
own set -->
-      <sysproperty key="dataDir" file="src/test"/>
-      <sysproperty key="tempDir" file="${build.dir}/test"/>
-      <sysproperty key="java.io.tmpdir" file="${build.dir}/test"/>
-
-      <!-- set as a system property so contrib tests can have a fixed root
-           to reference file paths from, and "ant test" can work from
-           anywhere.
-       -->
-      <sysproperty key="lucene.common.dir" file="${common.dir}" />
-      
-      <!-- contrib/ant IndexTaskTest needs these two system properties -->
-      <sysproperty key="docs.dir" file="src/test"/>
-      <sysproperty key="index.dir" file="${build.dir}/test/index"/>
-
-      <!-- contrib/benchmark uses this system property to locate docs data and defined
tasks -->
-      <sysproperty key="tasks.dir" file="${build.dir}/classes/java/org/apache/lucene/benchmark/byTask/tasks"/>
-      <sysproperty key="benchmark.work.dir" file="${common.dir}/contrib/benchmark/work"/>
-
-      <formatter type="xml"/>
-      <formatter type="brief" usefile="false"/>
-      <batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
-        <fileset dir="src/test" includes="${junit.includes}" excludes="${junit.excludes}"/>
-      </batchtest>
-      <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
-        <fileset dir="src/test" includes="**/${testcase}.java"/>
-      </batchtest>
-    </junit>
-    <!-- create this file, then if we don't fail, delete it -->
-    <!-- this meme makes it easy to tell if contribs have failed later -->
-    <echo file="${build.dir}/test/junitfailed.flag">MAYBE</echo>
-    <fail if="tests.failed">Tests failed!</fail>
-    <!-- life would be easier if echo had an 'if' attribute like fail -->
-    <delete file="${build.dir}/test/junitfailed.flag" />
-    
+    <test-macro dataDir="src/test" tempDir="${build.dir}/test">
+    	<contrib-settings>
+	      <!-- set as a system property so contrib tests can have a fixed root
+	           to reference file paths from, and "ant test" can work from
+	           anywhere.
+	       -->
+	      <sysproperty key="lucene.common.dir" file="${common.dir}" />
+	      
+	      <!-- contrib/ant IndexTaskTest needs these two system properties -->
+	      <sysproperty key="docs.dir" file="src/test"/>
+	      <sysproperty key="index.dir" file="${build.dir}/test/index"/>
+	
+	      <!-- contrib/benchmark uses this system property to locate docs data and defined
tasks -->
+	      <sysproperty key="tasks.dir" file="${build.dir}/classes/java/org/apache/lucene/benchmark/byTask/tasks"/>
+	      <sysproperty key="benchmark.work.dir" file="${common.dir}/contrib/benchmark/work"/>
+	  </contrib-settings>
+    </test-macro>
   </target>
 
     <!--



Mime
View raw message