You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ra...@apache.org on 2015/05/22 07:24:39 UTC

svn commit: r1680994 - in /zookeeper/trunk: CHANGES.txt README_packaging.txt build.xml

Author: rakeshr
Date: Fri May 22 05:24:39 2015
New Revision: 1680994

URL: http://svn.apache.org/r1680994
Log:
ZOOKEEPER-2191: Continue supporting prior Ant versions that don't implement the threads attribute for the JUnit task (Chris Nauroth via rakeshr)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/README_packaging.txt
    zookeeper/trunk/build.xml

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1680994&r1=1680993&r2=1680994&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Fri May 22 05:24:39 2015
@@ -152,6 +152,9 @@ IMPROVEMENTS:
   ZOOKEEPER-2126 Improve exit log messsage of EventThread and SendThread by
   adding SessionId (surendra singh lilhore via rakeshr)
 
+  ZOOKEEPER-2191: Continue supporting prior Ant versions that don't implement the
+  threads attribute for the JUnit task (Chris Nauroth via rakeshr)
+
 Release 3.5.0 - 8/4/2014
 
 NEW FEATURES:

Modified: zookeeper/trunk/README_packaging.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/README_packaging.txt?rev=1680994&r1=1680993&r2=1680994&view=diff
==============================================================================
--- zookeeper/trunk/README_packaging.txt (original)
+++ zookeeper/trunk/README_packaging.txt Fri May 22 05:24:39 2015
@@ -3,6 +3,7 @@ README file for Packaging Notes
 Requirement
 -----------
 
+ant (recommended version 1.9.4 or later for concurrent JUnit test execution)
 gcc, cppunit and python-setuptools are required to build 
 C and python bindings.
 

Modified: zookeeper/trunk/build.xml
URL: http://svn.apache.org/viewvc/zookeeper/trunk/build.xml?rev=1680994&r1=1680993&r2=1680994&view=diff
==============================================================================
--- zookeeper/trunk/build.xml (original)
+++ zookeeper/trunk/build.xml Fri May 22 05:24:39 2015
@@ -1292,24 +1292,62 @@ xmlns:maven="antlib:org.apache.maven.art
         </copy>
     </target>
 
-    <condition property="quicktest">
-      <and>
-        <equals arg1="${test.quick}" arg2="yes"/>
-        <not>
-          <isset property="testcase"/>
-        </not>
-      </and>
-    </condition>
-    <condition property="fulltest">
-      <and>
-        <equals arg1="${test.quick}" arg2="no"/>
-        <not>
-          <isset property="testcase"/>
-        </not>
-      </and>
-    </condition>
+    <target name="junit-init" depends="test-category">
+      <condition property="quicktest">
+        <and>
+          <equals arg1="${test.quick}" arg2="yes"/>
+          <not>
+            <isset property="testcase"/>
+          </not>
+        </and>
+      </condition>
+      <condition property="fulltest">
+        <and>
+          <equals arg1="${test.quick}" arg2="no"/>
+          <not>
+            <isset property="testcase"/>
+          </not>
+        </and>
+      </condition>
+      <condition property="ant.supports.concurrent.junit.processes">
+        <antversion atleast="1.9.4" />
+      </condition>
+      <property name="build.test.dir" value="${test.tmp.dir}" />
+      <property name="test.data.dir" value="${test.data.dir}" />
+      <property name="log4j.configuration"
+                value="file:${basedir}/conf/log4j.properties" />
+      <!-- superDigest is used by the tests/main code. If this is not set
+           as part of starting the jvm there is no guarantee that the static
+           initializers in the java code will see this (esp when running
+           with junit fork mode set to "once")-->
+      <property name="zookeeper.DigestAuthenticationProvider.superDigest"
+                value="super:D/InIHSb7yEEbrWz8b9l71RjZJU=" />
+      <propertyset id="junit.sys.properties">
+        <propertyref name="build.test.dir" />
+        <propertyref name="test.data.dir" />
+        <propertyref name="log4j.configuration" />
+        <propertyref name="zookeeper.DigestAuthenticationProvider.superDigest" />
+      </propertyset>
+      <path id="junit.classpath">
+        <path refid="test.java.classpath" />
+        <pathelement path="${test.java.classes}" />
+      </path>
+      <fileset id="quicktest.files" dir="${test.src.dir}">
+        <include name="**/*${test.category}Test.java" />
+        <exclude name="**/*HammerTest.java" />
+      </fileset>
+      <fileset id="fulltest.files" dir="${test.src.dir}">
+        <include name="**/*${test.category}Test.java" />
+      </fileset>
+      <fileset id="testcase.files" dir="${test.src.dir}">
+        <include name="**/${testcase}.java" />
+      </fileset>
+    </target>
+
+    <target name="junit.run" depends="junit-init,junit.run-single,junit.run-concurrent" />
 
-    <target name="junit.run">
+    <target name="junit.run-concurrent" if="ant.supports.concurrent.junit.processes">
+        <echo>Running ${test.junit.threads} concurrent JUnit processes.</echo>
         <junit showoutput="${test.output}"
                printsummary="${test.junit.printsummary}"
                haltonfailure="${test.junit.haltonfailure}"
@@ -1319,35 +1357,44 @@ xmlns:maven="antlib:org.apache.maven.art
                maxmemory="${test.junit.maxmem}"
                dir="${test.java.build.dir}" timeout="${test.timeout}"
                errorProperty="tests.failed" failureProperty="tests.failed">
-          <sysproperty key="build.test.dir" value="${test.tmp.dir}" />
-          <sysproperty key="test.data.dir" value="${test.data.dir}" />
-          <sysproperty key="log4j.configuration"
-                       value="file:${basedir}/conf/log4j.properties" />
-          <!-- superDigest is used by the tests/main code. If this is not set
-               as part of starting the jvm there is no guarantee that the static
-               initializers in the java code will see this (esp when running
-               with junit fork mode set to "once")-->
-          <sysproperty key="zookeeper.DigestAuthenticationProvider.superDigest"
-                       value="super:D/InIHSb7yEEbrWz8b9l71RjZJU=" />
+          <syspropertyset refid="junit.sys.properties" />
           <sysproperty key="test.junit.threads" value="${test.junit.threads}" />
-          <classpath refid="test.java.classpath"/>
-          <classpath>
-            <pathelement path="${test.java.classes}" />
-          </classpath>
+          <classpath refid="junit.classpath" />
+          <formatter type="${test.junit.output.format}" />
+          <batchtest todir="${test.log.dir}" if="quicktest">
+            <fileset refid="quicktest.files" />
+          </batchtest>
+          <batchtest todir="${test.log.dir}" if="fulltest">
+            <fileset refid="fulltest.files" />
+          </batchtest>
+          <batchtest todir="${test.log.dir}" if="testcase">
+            <fileset refid="testcase.files" />
+          </batchtest>
+        </junit>
+        <fail if="tests.failed">Tests failed!</fail>
+    </target>
+
+    <target name="junit.run-single" unless="ant.supports.concurrent.junit.processes">
+        <echo>Running single JUnit process.  Upgrade to Ant 1.9.4 or later to run multiple JUnit processes.</echo>
+        <junit showoutput="${test.output}"
+               printsummary="${test.junit.printsummary}"
+               haltonfailure="${test.junit.haltonfailure}"
+               fork="yes"
+               forkmode="${test.junit.fork.mode}"
+               maxmemory="${test.junit.maxmem}"
+               dir="${test.java.build.dir}" timeout="${test.timeout}"
+               errorProperty="tests.failed" failureProperty="tests.failed">
+          <syspropertyset refid="junit.sys.properties" />
+          <classpath refid="junit.classpath" />
           <formatter type="${test.junit.output.format}" />
           <batchtest todir="${test.log.dir}" if="quicktest">
-            <fileset dir="${test.src.dir}">
-              <include name="**/*${test.category}Test.java"/>
-              <exclude name="**/*HammerTest.java"/>
-            </fileset>
+            <fileset refid="quicktest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="fulltest">
-            <fileset dir="${test.src.dir}">
-              <include name="**/*${test.category}Test.java"/>
-            </fileset>
+            <fileset refid="fulltest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="testcase">
-            <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
+            <fileset refid="testcase.files" />
           </batchtest>
         </junit>
         <fail if="tests.failed">Tests failed!</fail>