blob: ff81fb362a2c3113fdf57f8771c940e3404e0c07 [file] [log] [blame]
ndai91f5c9b2006-03-12 13:56:45 +00001<?xml version="1.0"?>
david_williams403beae2007-12-09 02:10:40 +00002<project
3 name="JUnit tests"
4 basedir=".">
tle170c7902008-10-02 03:15:49 +00005 <property
tle3bda23c2009-07-22 16:23:03 +00006 environment="env"/>
7
8 <!-- required to get proper value of dropinsFolder -->
9 <property
10 name="keyCfgFile"
11 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
12 <echo
13 level="debug"
14 message="keyCfgFile: ${keyCfgFile}"/>
15 <property
16 file="${keyCfgFile}"/>
tle170c7902008-10-02 03:15:49 +000017 <target
18 name="init">
tle3bda23c2009-07-22 16:23:03 +000019 <!--
20 Parameters: (Mandatory) data-dir - the workspace directory
21 for Eclipse to write its data plugin-name - symboic name of
22 the plugin to test testPlugin - directory name of plugin
23 (with version suffix) classname - the name of the test class
24 (Optional - overrides defaults set in script) extraVMargs -
25 allows separate setting of VM args from separate caller.
26 timeout - overrides default test timeout value (in
27 milliseconds).
tle6eb7c062008-02-08 18:24:20 +000028 -->
tle6eb7c062008-02-08 18:24:20 +000029 <property
30 name="junit-report-output"
tle3bda23c2009-07-22 16:23:03 +000031 value="${testRoot}/results"/>
tle170c7902008-10-02 03:15:49 +000032 <mkdir
tle3bda23c2009-07-22 16:23:03 +000033 dir="${junit-report-output}/raw"/>
34 <!--
35 if not otherwise set, be sure extraVMargs is at least empty
36 string
37 -->
david_williams403beae2007-12-09 02:10:40 +000038 <property
39 name="extraVMargs"
tle3bda23c2009-07-22 16:23:03 +000040 value=""/>
tle6eb7c062008-02-08 18:24:20 +000041
tle3bda23c2009-07-22 16:23:03 +000042 <!-- if not otherwise set, use a unique workspace name -->
tle6eb7c062008-02-08 18:24:20 +000043 <property
44 name="data-dir"
tle3bda23c2009-07-22 16:23:03 +000045 value="${testRoot}/junitworkspaces/workspace-${classname}"/>
tle6eb7c062008-02-08 18:24:20 +000046 <property
47 name="testRoot"
tle3bda23c2009-07-22 16:23:03 +000048 value="${testRoot}"/>
49 <!-- temporarily changed from 30 minutes to 1 hrs
50 to help spot problematic tests -->
51 <!--
52 Some common values, of milliseconds to more recognizable units:
53 14400000: 4 hours
54 7200000: 2 hours
55 3600000: 1 hour
56 1800000: 30 minutes
57 600000: 10 minutes
58 -->
59
tle6eb7c062008-02-08 18:24:20 +000060 <property
61 name="timeout"
tle3bda23c2009-07-22 16:23:03 +000062 value="3600000"/>
tle6eb7c062008-02-08 18:24:20 +000063 <property
64 name="junit-report-output"
tle3bda23c2009-07-22 16:23:03 +000065 value="${junit-report-output}"/>
tle6eb7c062008-02-08 18:24:20 +000066 <property
67 name="plugin-path"
tleff165362009-07-27 17:11:33 +000068 value="${testRoot}${dropinsFolder}/eclipse/plugins/${testPlugin}"/>
tle6eb7c062008-02-08 18:24:20 +000069 <property
70 name="formatter"
tle3bda23c2009-07-22 16:23:03 +000071 value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
tle6eb7c062008-02-08 18:24:20 +000072 <property
73 name="test-output"
tle3bda23c2009-07-22 16:23:03 +000074 value="${junit-report-output}/raw/${classname}.xml"/>
tle6eb7c062008-02-08 18:24:20 +000075 <property
76 name="jvm"
tle3bda23c2009-07-22 16:23:03 +000077 value="${env.JAVA_6_HOME}/bin/java"/>
tle6eb7c062008-02-08 18:24:20 +000078 <dirname
79 file="${ant.file}"
tle3bda23c2009-07-22 16:23:03 +000080 property="currentDir"/>
tle6eb7c062008-02-08 18:24:20 +000081 <echo
82 level="debug"
tle3bda23c2009-07-22 16:23:03 +000083 message="data-dir: ${data-dir}"/>
tle6eb7c062008-02-08 18:24:20 +000084 <echo
85 level="debug"
tle3bda23c2009-07-22 16:23:03 +000086 message="plugin-name: ${plugin-name}"/>
tle6eb7c062008-02-08 18:24:20 +000087 <echo
88 level="debug"
tle3bda23c2009-07-22 16:23:03 +000089 message="testPlugin: ${testPlugin}"/>
tle6eb7c062008-02-08 18:24:20 +000090 <echo
91 level="debug"
tle3bda23c2009-07-22 16:23:03 +000092 message="classname: ${classname}"/>
tle6eb7c062008-02-08 18:24:20 +000093 <echo
94 level="debug"
tle3bda23c2009-07-22 16:23:03 +000095 message="extraVMargs: ${extraVMargs}"/>
tle6eb7c062008-02-08 18:24:20 +000096 <echo
97 level="debug"
tle3bda23c2009-07-22 16:23:03 +000098 message="timeout: ${timeout}"/>
tle6eb7c062008-02-08 18:24:20 +000099 <echo
100 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000101 message="testRoot: ${testRoot}"/>
tle6eb7c062008-02-08 18:24:20 +0000102 <echo
103 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000104 message="basedir: ${basedir}"/>
tle6eb7c062008-02-08 18:24:20 +0000105 <echo
106 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000107 message="eclipse-home: ${eclipse-home}"/>
tle6eb7c062008-02-08 18:24:20 +0000108 <echo
109 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000110 message="plugin-path: ${plugin-path}"/>
tle6eb7c062008-02-08 18:24:20 +0000111 <echo
112 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000113 message="junit-report-output: ${junit-report-output}"/>
tle6eb7c062008-02-08 18:24:20 +0000114 <echo
115 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000116 message="test-output: ${test-output}"/>
tle6eb7c062008-02-08 18:24:20 +0000117 <echo
118 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000119 message="buildDirectory: ${buildDirectory}"/>
tle6eb7c062008-02-08 18:24:20 +0000120 <echo
121 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000122 message="buildLabel: ${buildLabel}"/>
tle6eb7c062008-02-08 18:24:20 +0000123 <echo
124 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000125 message="jvm: ${jvm}"/>
tle6eb7c062008-02-08 18:24:20 +0000126 </target>
tle6eb7c062008-02-08 18:24:20 +0000127 <target
128 name="core-test"
129 depends="init">
130 <echo
131 level="info"
tle3bda23c2009-07-22 16:23:03 +0000132 message="test-type: core-test"/>
tle6eb7c062008-02-08 18:24:20 +0000133 <ant
134 antfile="${ant.file}"
135 dir="${currentDir}"
136 target="eclipse-test">
137 <property
david_williams403beae2007-12-09 02:10:40 +0000138 name="application"
tle3bda23c2009-07-22 16:23:03 +0000139 value="org.eclipse.test.coretestapplication"/>
tle6eb7c062008-02-08 18:24:20 +0000140 </ant>
david_williams403beae2007-12-09 02:10:40 +0000141 </target>
tle6eb7c062008-02-08 18:24:20 +0000142 <target
143 name="ui-test"
144 depends="init">
145 <echo
146 level="info"
tle3bda23c2009-07-22 16:23:03 +0000147 message="test-type: ui-test"/>
tle6eb7c062008-02-08 18:24:20 +0000148 <ant
149 antfile="${ant.file}"
150 dir="${currentDir}"
151 target="eclipse-test">
152 <property
david_williams403beae2007-12-09 02:10:40 +0000153 name="application"
tle3bda23c2009-07-22 16:23:03 +0000154 value="org.eclipse.test.uitestapplication"/>
tle6eb7c062008-02-08 18:24:20 +0000155 </ant>
david_williams403beae2007-12-09 02:10:40 +0000156 </target>
tle6eb7c062008-02-08 18:24:20 +0000157 <target
158 name="eclipse-test"
159 description="Runs the specified classname as a plug-in test.">
tle6eb7c062008-02-08 18:24:20 +0000160 <echo
161 level="info"
tle3bda23c2009-07-22 16:23:03 +0000162 message="Running ${classname}"/>
tle6eb7c062008-02-08 18:24:20 +0000163 <echo
164 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000165 message="Result file: ${junit-report-output}/${classname}.xml."/>
tle6eb7c062008-02-08 18:24:20 +0000166 <echo
167 level="debug"
tle3bda23c2009-07-22 16:23:03 +0000168 message="DISPLAY: ${env.DISPLAY}"/>
tle3bda23c2009-07-22 16:23:03 +0000169 <!--
170 If there is not exactly one launcher in the stack, we'd best
171 fail fast, since we are not expecting that, and may indicate
172 an installation that would produce unpredictable results
173 -->
174 <!--
175 requires ant 1.7, and at this point, we're running 1.6 from
176 eclipse ... <condition property="expectedNumberOfLaunchers">
177 <resourcecount when="equal" count="1" > <fileset
178 dir="${testRoot}/eclipse/plugins"> <include
179 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
180 </resourcecount> </condition> <fail message="Did not find
181 expected number of launcher jars. Check installation."
182 unless="expectedNumberOfLaunchers" />
tle6eb7c062008-02-08 18:24:20 +0000183 -->
184 <java
185 taskname="suiteUnitTest"
186 fork="true"
187 resultProperty="suitejunitresult"
188 failonerror="false"
189 timeout="${timeout}"
190 dir="${testRoot}/eclipse"
tle170c7902008-10-02 03:15:49 +0000191 jvm="${jvm}"
tle6eb7c062008-02-08 18:24:20 +0000192 classname="org.eclipse.equinox.launcher.Main">
193 <classpath>
tle170c7902008-10-02 03:15:49 +0000194 <fileset
195 dir="${testRoot}/eclipse/plugins">
196 <include
tle3bda23c2009-07-22 16:23:03 +0000197 name="org.eclipse.equinox.launcher_*.jar"/>
tle6eb7c062008-02-08 18:24:20 +0000198 </fileset>
199 </classpath>
tle170c7902008-10-02 03:15:49 +0000200 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000201 value="-Xmx758m"/>
tle170c7902008-10-02 03:15:49 +0000202 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000203 value="-Dosgi.ws=${env.BASEWS}"/>
tle170c7902008-10-02 03:15:49 +0000204 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000205 value="-Dosgi.os=${env.BASEOS}"/>
tle170c7902008-10-02 03:15:49 +0000206 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000207 value="-Dosgi.arch=${env.BASEARCH}"/>
tle170c7902008-10-02 03:15:49 +0000208 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000209 value="-DbuildLabel=${buildLabel}"/>
tle170c7902008-10-02 03:15:49 +0000210 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000211 value="-DbuildDirectory=${buildDirectory}"/>
tle170c7902008-10-02 03:15:49 +0000212 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000213 value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol"/>
tle170c7902008-10-02 03:15:49 +0000214 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000215 value="-DurlLogLocation=${buildDirectory}/outgoinghttplogfromtests.log"/>
tle170c7902008-10-02 03:15:49 +0000216 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000217 value="-Dwtp.autotest.noninteractive=true"/>
tle170c7902008-10-02 03:15:49 +0000218 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000219 value="-DPLUGIN_PATH=${plugin-path}"/>
tle170c7902008-10-02 03:15:49 +0000220 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000221 line="${extraVMargs}"/>
tle170c7902008-10-02 03:15:49 +0000222 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000223 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williams249fae52008-05-02 03:41:42 +0000224 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000225 value="-Dprojectname=${projectname}"/>
tle170c7902008-10-02 03:15:49 +0000226 <arg
tle3bda23c2009-07-22 16:23:03 +0000227 value="-nosplash"/>
tle170c7902008-10-02 03:15:49 +0000228 <arg
tle3bda23c2009-07-22 16:23:03 +0000229 value="-consolelog"/>
tle170c7902008-10-02 03:15:49 +0000230 <arg
tle3bda23c2009-07-22 16:23:03 +0000231 value="-debug"/>
tle170c7902008-10-02 03:15:49 +0000232 <arg
tle3bda23c2009-07-22 16:23:03 +0000233 value="-data"/>
tle170c7902008-10-02 03:15:49 +0000234 <arg
tle3bda23c2009-07-22 16:23:03 +0000235 value="${data-dir}"/>
tle170c7902008-10-02 03:15:49 +0000236 <arg
tle3bda23c2009-07-22 16:23:03 +0000237 value="-application"/>
tle170c7902008-10-02 03:15:49 +0000238 <arg
tle3bda23c2009-07-22 16:23:03 +0000239 value="${application}"/>
tle170c7902008-10-02 03:15:49 +0000240 <arg
tle3bda23c2009-07-22 16:23:03 +0000241 value="formatter=${formatter},${test-output}"/>
tle170c7902008-10-02 03:15:49 +0000242 <arg
tle3bda23c2009-07-22 16:23:03 +0000243 value="-testPluginName"/>
tle170c7902008-10-02 03:15:49 +0000244 <arg
tle3bda23c2009-07-22 16:23:03 +0000245 value="${plugin-name}"/>
tle170c7902008-10-02 03:15:49 +0000246 <arg
tle3bda23c2009-07-22 16:23:03 +0000247 value="-className"/>
tle170c7902008-10-02 03:15:49 +0000248 <arg
tle3bda23c2009-07-22 16:23:03 +0000249 value="${classname}"/>
tle6eb7c062008-02-08 18:24:20 +0000250 <env
251 key="DISPLAY"
tle3bda23c2009-07-22 16:23:03 +0000252 value="${env.DISPLAY}"/>
tle6eb7c062008-02-08 18:24:20 +0000253 <redirector
254 output="${junit-report-output}/${classname}.output.txt"
tle3bda23c2009-07-22 16:23:03 +0000255 error="${junit-report-output}/${classname}.error.txt"/>
tle6eb7c062008-02-08 18:24:20 +0000256 </java>
tle6eb7c062008-02-08 18:24:20 +0000257 <echo
258 level="info"
tle3bda23c2009-07-22 16:23:03 +0000259 message="suitejunitresult: ${suitejunitresult}"/>
tle170c7902008-10-02 03:15:49 +0000260 <antcall
tle3bda23c2009-07-22 16:23:03 +0000261 target="summarizeFailure"/>
tle170c7902008-10-02 03:15:49 +0000262 <antcall
tle3bda23c2009-07-22 16:23:03 +0000263 target="collect-results"/>
tle6eb7c062008-02-08 18:24:20 +0000264 </target>
tle170c7902008-10-02 03:15:49 +0000265 <target
266 name="collect-results">
tle6eb7c062008-02-08 18:24:20 +0000267 <dirname
268 property="output-dir"
tle3bda23c2009-07-22 16:23:03 +0000269 file="${test-output}"/>
tle6eb7c062008-02-08 18:24:20 +0000270 <basename
271 property="output-file-name"
tle3bda23c2009-07-22 16:23:03 +0000272 file="${test-output}"/>
tle170c7902008-10-02 03:15:49 +0000273 <mkdir
tle3bda23c2009-07-22 16:23:03 +0000274 dir="${junit-report-output}/xml"/>
tle6eb7c062008-02-08 18:24:20 +0000275 <junitreport
276 todir="${junit-report-output}/xml"
277 tofile="${classname}.xml">
tle170c7902008-10-02 03:15:49 +0000278 <fileset
279 dir="${output-dir}">
280 <include
tle3bda23c2009-07-22 16:23:03 +0000281 name="${output-file-name}"/>
tle6eb7c062008-02-08 18:24:20 +0000282 </fileset>
283 </junitreport>
tle170c7902008-10-02 03:15:49 +0000284 <mkdir
tle3bda23c2009-07-22 16:23:03 +0000285 dir="${junit-report-output}/html"/>
tle6eb7c062008-02-08 18:24:20 +0000286 <xslt
287 style="${testRoot}/JUNIT.XSL"
288 basedir="${junit-report-output}"
289 includes="${classname}.xml"
tle3bda23c2009-07-22 16:23:03 +0000290 destdir="${junit-report-output}/html"/>
tle6eb7c062008-02-08 18:24:20 +0000291 <copy
292 file="${data-dir}/.metadata/.log"
293 toFile="${testRoot}/results/consolelogs/metadata-logs/${classname}.workspace.log"
294 overwrite="true"
tle3bda23c2009-07-22 16:23:03 +0000295 failonError="false"/>
296 <!--
297 todo: this, especially, should be concat (there could be
298 more than one, in theory)
299 -->
tle6eb7c062008-02-08 18:24:20 +0000300 <copy
301 file="${testRoot}/eclipse/configuration/*.log"
302 toFile="${testRoot}/results/consolelogs/configuration-logs/${classname}.config.log"
303 overwrite="true"
tle3bda23c2009-07-22 16:23:03 +0000304 failonError="false"/>
tle6eb7c062008-02-08 18:24:20 +0000305 </target>
tle170c7902008-10-02 03:15:49 +0000306 <target
307 name="collect">
tle3bda23c2009-07-22 16:23:03 +0000308 <!--
309 deprecated, each test.xml uses it, and we should remove,
310 eventually
311 -->
tle170c7902008-10-02 03:15:49 +0000312 </target>
313 <target
314 name="summarizeFailure"
315 depends="checkFailure"
316 if="doFailure">
317 <echo
318 append="true"
319 file="${buildDirectory}/junitFailureList.log">${plugin-name}${line.separator}</echo>
320 </target>
321 <target
322 name="checkFailure">
323 <condition
324 property="doFailure">
325 <not>
326 <equals
327 arg1="${suitejunitresult}"
328 arg2="0"
tle3bda23c2009-07-22 16:23:03 +0000329 trim="true"/>
tle170c7902008-10-02 03:15:49 +0000330 </not>
331 </condition>
332 </target>
333</project>