blob: 4475c540cba69efe885bd3717dfe4406d6fe9dd0 [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">
<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}"/>
<!--
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="1800000"/>
<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="info"
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}"/>
<mkdir
dir="${buildDirectory}/${buildLabel}/httplogstest"/>
<echo
message="http log messages to: ${buildDirectory}/${buildLabel}/httplogstest"/>
<condition
property="xulRunnerParam"
value="org.eclipse.swt.browser.XULRunnerPath"
else="XULRunnerPathNotSpecified">
<isset
property="env.WTP_XULRUNNER"/>
</condition>
<echo
message="xulRunnerParam: ${xulRunnerParam}"/>
<echo
message="WTP_XULRUNNER: ${env.WTP_XULRUNNER}"/>
<!--
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="-Xmx512m"/>
<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}/${buildLabel}/httplogstest/outgoinghttplog-${plugin-name}.log"/>
<jvmarg
value="-Dwtp.autotest.noninteractive=true"/>
<jvmarg
value="${extraVMargs}"/>
<jvmarg
value="-Declipse.consolelog=true"/>
<jvmarg
value="-Dosgi.debug"/>
<jvmarg
value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
<jvmarg
value="-Dprojectname=${projectname}"/>
<jvmarg
value="-D${xulRunnerParam}=${env.WTP_XULRUNNER}"/>
<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">
<!--
deprecated, each test.xml uses it, and we should remove,
eventually
-->
<echo
message="Deprecated. There is no need to call the collect task. It no longer does anything. Please remove from your test.xml file"/>
</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>