|
@@ -1292,24 +1292,62 @@ xmlns:maven="antlib:org.apache.maven.artifact.ant">
|
|
|
</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">
|
|
|
+ <target name="junit.run" depends="junit-init,junit.run-single,junit.run-concurrent" />
|
|
|
+
|
|
|
+ <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.artifact.ant">
|
|
|
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 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 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 refid="quicktest.files" />
|
|
|
+ </batchtest>
|
|
|
+ <batchtest todir="${test.log.dir}" if="fulltest">
|
|
|
+ <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>
|