blob: 245923a142b2b37986345e40752fb6869b076f4c [file] [log] [blame]
<?xml version="1.0"?>
<project
name="JUnit tests"
basedir=".">
<property
environment="env"/>
<!-- required to get proper value of dropinsFolder -->
<property
name="keyCfgFile"
value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
<echo
level="debug"
message="keyCfgFile: ${keyCfgFile}"/>
<property
file="${keyCfgFile}"/>
<target
name="init">
<!--
Parameters: (Mandatory) data-dir - the workspace directory
for Eclipse to write its data plugin-name - directory name
of plugin (with version suffix) classname - the name of the
test class (Optional - overrides defaults set in script)
extraVMargs - allows separate setting of VM args from
separate caller. timeout - overrides default test timeout
value (in milliseconds).
-->
<property
name="junit-report-output"
value="${testRoot}/results"/>
<mkdir
dir="${junit-report-output}/raw"/>
<!--
if not otherwise set, be sure extraVMargs is at least some
string, even if unused string
-->
<property
name="extraVMargs"
value="-Dunused=notuse"/>
<!-- if not otherwise set, use a unique workspace name -->
<property
name="data-dir"
value="${testRoot}/junitworkspaces/workspace-${classname}"/>
<property
name="testRoot"
value="${testRoot}"/>
<!--
temporarily changed from 30 minutes to 1 hrs to help spot
problematic tests
-->
<!--
Some common values, of milliseconds to more recognizable
units: 14400000: 4 hours 7200000: 2 hours 3600000: 1 hour
1800000: 30 minutes 600000: 10 minutes
-->
<property
name="timeout"
value="3600000"/>
<property
name="junit-report-output"
value="${junit-report-output}"/>
<property
name="formatter"
value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
<property
name="test-output"
value="${junit-report-output}/raw/${classname}.xml"/>
<property
name="jvm"
value="${env.JAVA_6_HOME}/bin/java"/>
<dirname
file="${ant.file}"
property="currentDir"/>
<echo
level="debug"
message="data-dir: ${data-dir}"/>
<echo
level="debug"
message="plugin-name: ${plugin-name}"/>
<echo
level="debug"
message="classname: ${classname}"/>
<echo
level="debug"
message="extraVMargs: ${extraVMargs}"/>
<echo
level="debug"
message="timeout: ${timeout}"/>
<echo
level="debug"
message="testRoot: ${testRoot}"/>
<echo
level="debug"
message="basedir: ${basedir}"/>
<echo
level="debug"
message="eclipse-home: ${eclipse-home}"/>
<echo
level="debug"
message="junit-report-output: ${junit-report-output}"/>
<echo
level="debug"
message="test-output: ${test-output}"/>
<echo
level="debug"
message="buildDirectory: ${buildDirectory}"/>
<echo
level="debug"
message="buildLabel: ${buildLabel}"/>
<echo
level="debug"
message="jvm: ${jvm}"/>
</target>
<target
name="core-test"
depends="init">
<echo
level="info"
message="test-type: core-test"/>
<ant
antfile="${ant.file}"
dir="${currentDir}"
target="eclipse-test">
<property
name="application"
value="org.eclipse.test.coretestapplication"/>
</ant>
</target>
<target
name="ui-test"
depends="init">
<echo
level="info"
message="test-type: ui-test"/>
<ant
antfile="${ant.file}"
dir="${currentDir}"
target="eclipse-test">
<property
name="application"
value="org.eclipse.test.uitestapplication"/>
</ant>
</target>
<target
name="eclipse-test"
description="Runs the specified classname as a plug-in test.">
<echo
level="info"
message="Running ${classname}"/>
<echo
level="debug"
message="Result file: ${junit-report-output}/${classname}.xml."/>
<echo
level="debug"
message="DISPLAY: ${env.DISPLAY}"/>
<!--
If there is not exactly one launcher in the stack, we'd best
fail fast, since we are not expecting that, and may indicate
an installation that would produce unpredictable results
-->
<!--
requires ant 1.7, and at this point, we're running 1.6 from
eclipse ... <condition property="expectedNumberOfLaunchers">
<resourcecount when="equal" count="1" > <fileset
dir="${testRoot}/eclipse/plugins"> <include
name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
</resourcecount> </condition> <fail message="Did not find
expected number of launcher jars. Check installation."
unless="expectedNumberOfLaunchers" />
-->
<java
taskname="suiteUnitTest"
fork="true"
resultProperty="suitejunitresult"
failonerror="false"
timeout="${timeout}"
dir="${testRoot}/eclipse"
jvm="${jvm}"
classname="org.eclipse.equinox.launcher.Main">
<classpath>
<fileset
dir="${testRoot}/eclipse/plugins">
<include
name="org.eclipse.equinox.launcher_*.jar"/>
</fileset>
</classpath>
<jvmarg
value="-Xmx758m"/>
<jvmarg
value="-Dosgi.ws=${env.BASEWS}"/>
<jvmarg
value="-Dosgi.os=${env.BASEOS}"/>
<jvmarg
value="-Dosgi.arch=${env.BASEARCH}"/>
<jvmarg
value="-DbuildLabel=${buildLabel}"/>
<jvmarg
value="-DbuildDirectory=${buildDirectory}"/>
<jvmarg
value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol"/>
<jvmarg
value="-DurlLogLocation=${buildDirectory}/outgoinghttplogfromtests.log"/>
<jvmarg
value="-Dwtp.autotest.noninteractive=true"/>
<jvmarg
value="${extraVMargs}"/>
<jvmarg
value="-Declipse.consolelog=true"/>
<jvmarg
value="-Dosgi.debug=true"/>
<jvmarg
value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
<jvmarg
value="-Dprojectname=${projectname}"/>
<arg
value="-nosplash"/>
<arg
value="-data"/>
<arg
value="${data-dir}"/>
<arg
value="-application"/>
<arg
value="${application}"/>
<arg
value="formatter=${formatter},${test-output}"/>
<arg
value="-testPluginName"/>
<arg
value="${plugin-name}"/>
<arg
value="-className"/>
<arg
value="${classname}"/>
<env
key="DISPLAY"
value="${env.DISPLAY}"/>
<redirector
output="${junit-report-output}/${classname}.output.txt"
error="${junit-report-output}/${classname}.error.txt"/>
</java>
<echo
level="info"
message="suitejunitresult: ${suitejunitresult}"/>
<antcall
target="summarizeFailure"/>
<antcall
target="collect-results"/>
</target>
<target
name="collect-results">
<dirname
property="output-dir"
file="${test-output}"/>
<basename
property="output-file-name"
file="${test-output}"/>
<mkdir
dir="${junit-report-output}/xml"/>
<junitreport
todir="${junit-report-output}/xml"
tofile="${classname}.xml">
<fileset
dir="${output-dir}">
<include
name="${output-file-name}"/>
</fileset>
</junitreport>
<mkdir
dir="${junit-report-output}/html"/>
<xslt
style="${testRoot}/JUNIT.XSL"
basedir="${junit-report-output}"
includes="${classname}.xml"
destdir="${junit-report-output}/html"/>
</target>
<target
name="collect">
<echo
message="The 'collect' task is deprecated. It does nothing. Please remove the call to 'collect' task from your test.xml"/>
</target>
<target
name="summarizeFailure"
depends="checkFailure"
if="doFailure">
<echo
append="true"
file="${buildDirectory}/junitFailureList.log">${plugin-name}${line.separator}</echo>
</target>
<target
name="checkFailure">
<condition
property="doFailure">
<not>
<equals
arg1="${suitejunitresult}"
arg2="0"
trim="true"/>
</not>
</condition>
</target>
</project>