| <?xml version="1.0"?> |
| <project name="JUnit tests" basedir="."> |
| |
| <property environment="env" /> |
| |
| <target name="init"> |
| <!-- |
| Parameters: |
| (Mandatory) |
| data-dir - the directory for Eclipse to write its data |
| plugin-name - the name of the plugin to test |
| classname - the name of the test class |
| |
| (Optional - overrides defaults set in script) |
| vmargs - a string containing arguments to pass to the VM. |
| extraVMargs - allows separate setting of VM args from separate caller. |
| timeout - overrides default test timeout value (in milliseconds). |
| test-output - overrides default output file produced from test run. |
| plugin-path - path to root of plug-in |
| useEclipseExe - property setting forces test to launch via eclipse executable. |
| junit-report-output - output directory for junit reports produced for specified classname. |
| --> |
| |
| <property name="junit-report-output" value="${testRoot}/results" /> |
| |
| |
| |
| <mkdir dir="${junit-report-output}/raw" /> |
| |
| <property name="otherVMArgs" value=" -Dwtp.autotest.noninteractive=true -Dosgi.clean=true -Dosgi.ws=${env.BASEWS} -Dosgi.os=${env.BASEOS} -Dosgi.arch=${env.BASEARCH}" /> |
| |
| <!-- if not otherwise set, be sure extraVMargs is at least empty string --> |
| <property name="extraVMargs" value="" /> |
| |
| <property name="testRoot" value="${testRoot}" /> |
| <property name="extraVMargs" value="${extraVMargs} ${otherVMArgs}" /> |
| <property name="timeout" value="600000" /> |
| <property name="junit-report-output" value="${junit-report-output}" /> |
| <property name="plugin-path" value="${basedir}/plugins/${testPlugin}" /> |
| <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="classname" value="${classname}" /> |
| <property name="jvm" value="${env.JAVA_5_HOME}/bin/java" /> |
| |
| <dirname file="${ant.file}" property="currentDir" /> |
| |
| |
| <echo message="basedir: ${basedir}" /> |
| <echo message="eclipse-home: ${eclipse-home}" /> |
| <echo message="testRoot: ${testRoot}" /> |
| <echo message="class-name: ${classname}" /> |
| <echo message="plugin-name: ${plugin-name}" /> |
| <echo message="plugin-direcotory: ${testPlugin}" /> |
| <echo message="junit-report-output: ${junit-report-output}" /> |
| <echo message="test-output: ${test-output}" /> |
| |
| <echo message="jvm: ${env.JAVA_5_HOME}/bin/java" /> |
| |
| |
| |
| </target> |
| |
| |
| |
| <target name="core-test" depends="init"> |
| <echo 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 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."> |
| <property name="vmargs" value="-Xms256m -Xmx512m" /> |
| |
| <!--use -consolelog if launching a headless test--> |
| <condition property="consolelog" value="-consolelog"> |
| <equals arg1="${application}" |
| arg2="org.eclipse.test.coretestapplication" /> |
| </condition> |
| <property name="consolelog" value="" /> |
| |
| <!-- |
| vm selection priority: |
| 1. user-specified java executable via outer Ant property setting of "jvm". |
| 2. java executable on path. |
| --> |
| <condition property="test-vm" value="-vm ${jvm}"> |
| <isset property="jvm" /> |
| </condition> |
| <property name="test-vm" value="" /> |
| |
| <echo message="Running ${classname}" /> |
| <echo |
| message="Result file: ${junit-report-output}/${classname}.xml." /> |
| <echo message="DISPLAY: ${env.DISPLAY}" /> |
| |
| <java |
| taskname="unit-test-${classname}" |
| |
| fork="true" |
| resultProperty="wtpjunitresult-${classname}" |
| failonerror="false" |
| timeout="${timeout}" |
| |
| dir="${testRoot}/eclipse" |
| jvm="${env.JAVA_5_HOME}/bin/java" |
| |
| classname="org.eclipse.equinox.launcher.Main" > |
| <classpath> |
| <fileset dir="${testRoot}/eclipse/plugins"> |
| <include name="org.eclipse.equinox.launcher_*.jar"/> |
| </fileset> |
| </classpath> |
| |
| <arg line="-data ${data-dir}" /> |
| <arg line="${test-vm}" /> |
| <arg line="-application ${application}" /> |
| <arg line="formatter=${formatter},${test-output}" /> |
| <arg line="-testPluginName ${plugin-name}" /> |
| <arg line="-className ${classname}" /> |
| <arg line="-nosplash" /> |
| <arg line="-suppressErrors" /> |
| <arg line="${consolelog}" /> |
| <arg |
| line="-vmargs ${vmargs} ${extraVMargs} -DPLUGIN_PATH=${plugin-path}" /> |
| <env key="DISPLAY" value="${env.DISPLAY}" /> |
| <redirector |
| output="${junit-report-output}/${classname}.output.txt" |
| error="${junit-report-output}/${classname}.error.txt" |
| alwayslog="true" /> |
| </java> |
| <antcall target="collect-results" inheritAll="true" /> |
| </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" /> |
| <style style="${testRoot}/JUNIT.XSL" |
| basedir="${junit-report-output}" includes="${classname}.xml" |
| destdir="${junit-report-output}/html" /> |
| |
| |
| <copy file="${data-dir}/.metadata/.log" |
| toFile="${testRoot}/results/consolelogs/metadata-logs/${classname}.workspace.log" |
| overwrite="true" |
| failonError="false" /> |
| |
| <!-- todo: this, especially, should be concat (there could be more than one, in theory) --> |
| <copy file="${testRoot}/eclipse/configuration/*.log" |
| toFile="${testRoot}/results/consolelogs/configuration-logs/${classname}.config.log" |
| overwrite="true" |
| failonError="false" /> |
| |
| </target> |
| |
| <target name="collect"> |
| <!-- deprecated, each test.xml uses it, and we should remove, eventually --> |
| </target> |
| |
| |
| |
| |
| |
| </project> |