Change-Id: I17338a82fd97a12eaafc1b64a91ebe35de1fb270 Former-commit-id: 466b16f5052e3a848980976cfbdcf5dff95673c9
161 lines
6.1 KiB
XML
161 lines
6.1 KiB
XML
<project name="tests" basedir="." default="run-tests">
|
|
|
|
<target name="env-check">
|
|
<available file="${basedir}/../javax.mail" property="jenkins.build" />
|
|
</target>
|
|
|
|
<target name="env-developer" depends="env-check" unless="jenkins.build">
|
|
<property name="build.properties.file" value="developer-build.properties" />
|
|
</target>
|
|
|
|
<target name="env-jenkins" depends="env-check" if="jenkins.build">
|
|
<property name="build.properties.file" value="jenkins-build.properties" />
|
|
</target>
|
|
|
|
<target name="env-setup" description="Sets up the environment" depends="env-check, env-developer, env-jenkins">
|
|
<property environment="env" />
|
|
<property file="${build.properties.file}" />
|
|
<property file="build.properties" />
|
|
<property file="${BUILD.EDEX.PROPERTIES}" />
|
|
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
<classpath>
|
|
<fileset file="${ANT.CONTRIB.JAR}" />
|
|
</classpath>
|
|
</taskdef>
|
|
|
|
<delete dir="${WORKING.DIR}" />
|
|
</target>
|
|
|
|
<target name="classpath-setup-developer" depends="env-setup" unless="jenkins.build">
|
|
<path id="test.compile.classpath">
|
|
<dirset dir="${AWIPS2_BASELINE}" includes="**/bin" />
|
|
<fileset dir="${AWIPS2_BASELINE}/cots/org.hamcrest" includes="**/*.jar" />
|
|
<fileset dir="${AWIPS2_BASELINE}/cots/org.mockito" includes="**/*.jar" />
|
|
<fileset dir="${AWIPS2_BASELINE}/cots/org.springframework" includes="**/*.jar" />
|
|
<fileset dir="${AWIPS2_BASELINE}/cots/org.slf4j" includes="**/*.jar" />
|
|
<fileset dir="${AWIPS2_BASELINE}/cots" includes="**/*.jar" excludes="**/ant-*.jar" />
|
|
<fileset dir="${PROJECTS.DIR}/cots" includes="**/*.jar" />
|
|
<dirset dir="${PROJECTS.DIR}" includes="**/bin" />
|
|
<fileset dir="${basedir}/lib" includes="**/*.jar" />
|
|
</path>
|
|
|
|
<path id="test.run.classpath">
|
|
<!-- Currently nothing else required here -->
|
|
</path>
|
|
</target>
|
|
|
|
<target name="classpath-setup-jenkins" depends="env-setup" if="jenkins.build">
|
|
<mkdir dir="${UNZIP.DIR}" />
|
|
|
|
<for param="zipFile">
|
|
<path>
|
|
<fileset dir="${BUILD.EDEX.DIST.DIR}" includes="*.zip" />
|
|
</path>
|
|
<sequential>
|
|
<unzip dest="${UNZIP.DIR}" src="@{zipFile}" />
|
|
</sequential>
|
|
</for>
|
|
|
|
<path id="test.compile.classpath">
|
|
<fileset dir="${UNZIP.DIR}" includes="**/*.jar" excludes="**/ant-*.jar" />
|
|
<fileset dir="${PROJECTS.DIR}/org.hamcrest" includes="**/*.jar" />
|
|
<fileset dir="${PROJECTS.DIR}/org.mockito" includes="**/*.jar" />
|
|
<fileset dir="${PROJECTS.DIR}/org.springframework" includes="**/*.jar" />
|
|
<fileset dir="${PROJECTS.DIR}/org.slf4j" includes="**/*.jar" />
|
|
<fileset dir="${basedir}/lib" includes="**/*.jar" />
|
|
<fileset dir="${JUNIT}" includes="**/*.jar" />
|
|
</path>
|
|
|
|
<!-- Include resource files provided by projects -->
|
|
<path id="test.run.classpath">
|
|
<dirset dir="${PROJECTS.DIR}" includes="*/resources" />
|
|
<dirset dir="${PROJECTS.DIR}" includes="*/res" />
|
|
</path>
|
|
</target>
|
|
|
|
<target name="classpath-setup" depends="classpath-setup-developer, classpath-setup-jenkins" />
|
|
|
|
<target name="compile-tests" depends="classpath-setup" description="Compiles all tests">
|
|
<delete dir="${TEST.COMPILE.DIR}" />
|
|
<mkdir dir="${TEST.COMPILE.DIR}" />
|
|
|
|
<forEachTestType>
|
|
<javac srcdir="${basedir}/@{testType}" excludes="${TEST.EXCLUSION.PATTERN}" destdir="${TEST.COMPILE.DIR}" classpathref="test.compile.classpath" debug="on" source="${javacSource}" target="${javacTarget}" />
|
|
</forEachTestType>
|
|
</target>
|
|
|
|
<target name="run-tests" depends="compile-tests" description="Runs all tests">
|
|
<delete dir="${TEST.REPORTS.DIR}" />
|
|
<mkdir dir="${TEST.REPORTS.DIR}" />
|
|
|
|
<forEachTestType>
|
|
<var name="testTypeSourceDir" value="${basedir}/@{testType}" />
|
|
<!-- Test type forking settings -->
|
|
<propertycopy name="forkTests" from="@{testType}.FORK.TESTS" override="true" />
|
|
<propertycopy name="forkMode" from="@{testType}.FORK.MODE" override="true" />
|
|
<propertycopy name="forkCloneVm" from="@{testType}.FORK.CLONEVM" override="true" />
|
|
|
|
<junit printsummary="yes" forkmode="${forkMode}" clonevm="${forkCloneVm}" haltonfailure="no" failureproperty="tests.failed">
|
|
<jvmarg line="-Duser.dir=${testTypeSourceDir} -XX:PermSize=${env.INITIAL_PERMGEN_SIZE} -XX:MaxPermSize=${env.MAX_PERMGEN_SIZE}" />
|
|
<classpath>
|
|
<!-- Any resources for tests -->
|
|
<pathelement location="${testTypeSourceDir}" />
|
|
<pathelement location="${basedir}/resources" />
|
|
<!-- Referenced jar files -->
|
|
<path refid="test.compile.classpath" />
|
|
<path refid="test.run.classpath" />
|
|
<!-- Compiled tests -->
|
|
<pathelement location="${TEST.COMPILE.DIR}" />
|
|
</classpath>
|
|
|
|
<formatter type="xml" />
|
|
|
|
<batchtest fork="${forkTests}" todir="${TEST.REPORTS.DIR}">
|
|
<fileset dir="${basedir}/@{testType}" includes="${TEST.INCLUSION.PATTERN}" excludes="${TEST.EXCLUSION.PATTERN}" />
|
|
</batchtest>
|
|
</junit>
|
|
</forEachTestType>
|
|
|
|
<antcall target="send.email"/>
|
|
|
|
<junitreport todir="${TEST.REPORTS.DIR}">
|
|
<fileset dir="${TEST.REPORTS.DIR}">
|
|
<include name="TEST-*.xml"/>
|
|
</fileset>
|
|
<report format="frames" todir="${TEST.REPORTS.DIR}/html"/>
|
|
</junitreport>
|
|
</target>
|
|
|
|
<macrodef name="forEachTestType" description="Loops over all requested test types, and performs the passed in action">
|
|
<element name="action" implicit="true" />
|
|
<sequential>
|
|
<for list="${testTypes}" param="testType">
|
|
<sequential>
|
|
<action />
|
|
</sequential>
|
|
</for>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="send.email" depends="mail.check" if="send.mail">
|
|
<mail mailhost="localhost" mailport="25" subject="Unit Test Failures">
|
|
<from address="jenkins@halfmaen.omaha.us.ray.com" />
|
|
<replyto address="steven_l_harris@raytheon.com" />
|
|
<to address="michael.duff@raytheon.com" />
|
|
<to address="david_j_hladky@raytheon.com" />
|
|
<to address="bradley_l_gonzales@raytheon.com" />
|
|
<to address="benjamin_d_phillippe@raytheon.com" />
|
|
<message>Nightly build has unit test failures. http://awipscm/junit/</message>
|
|
</mail>
|
|
</target>
|
|
|
|
<target name="mail.check">
|
|
<condition property="send.mail">
|
|
<and>
|
|
<isset property="tests.failed" />
|
|
<isset property="jenkins.build" />
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
</project>
|