blob: bf639623f2a4be6360ea8a852c003c521526de81 [file] [log] [blame]
david_williams0ecd8ec2009-11-09 04:16:21 +00001<?xml version="1.0"?>
2<project
3 name="JUnit tests"
4 basedir=".">
5 <property
6 environment="env"/>
7 <!-- required to get proper value of dropinsFolder -->
8 <property
9 name="keyCfgFile"
10 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
11 <echo
12 level="debug"
13 message="keyCfgFile: ${keyCfgFile}"/>
14 <property
15 file="${keyCfgFile}"/>
16 <target
17 name="init">
david_williams0ecd8ec2009-11-09 04:16:21 +000018 <property
19 name="junit-report-output"
20 value="${testRoot}/results"/>
21 <mkdir
22 dir="${junit-report-output}/raw"/>
23 <!--
david_williamsdb9eed92009-11-18 20:03:49 +000024 if not otherwise set, be sure extraVMargs is at least some
david_williams05fbdde2009-11-21 20:14:13 +000025 string, even if unused string.
26
27 Remember, though, extraVMArgs can contain more than one extra arg,
28 so much be passed to VM as a "line", not "value".
david_williams0ecd8ec2009-11-09 04:16:21 +000029 -->
30 <property
31 name="extraVMargs"
david_williams05fbdde2009-11-21 20:14:13 +000032 value="-DextraVMargsunused=notused"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000033
34 <!-- if not otherwise set, use a unique workspace name -->
35 <property
36 name="data-dir"
37 value="${testRoot}/junitworkspaces/workspace-${classname}"/>
38 <property
39 name="testRoot"
40 value="${testRoot}"/>
david_williamsdb9eed92009-11-18 20:03:49 +000041 <!--
42 Some common values, of milliseconds to more recognizable
43 units: 14400000: 4 hours 7200000: 2 hours 3600000: 1 hour
44 1800000: 30 minutes 600000: 10 minutes
45 -->
david_williams0ecd8ec2009-11-09 04:16:21 +000046 <property
47 name="timeout"
48 value="1800000"/>
49 <property
50 name="junit-report-output"
51 value="${junit-report-output}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000052 <property
53 name="formatter"
54 value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
55 <property
56 name="test-output"
57 value="${junit-report-output}/raw/${classname}.xml"/>
58 <property
59 name="jvm"
60 value="${env.JAVA_6_HOME}/bin/java"/>
61 <dirname
62 file="${ant.file}"
63 property="currentDir"/>
64 <echo
65 level="debug"
66 message="data-dir: ${data-dir}"/>
67 <echo
68 level="debug"
69 message="plugin-name: ${plugin-name}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000070 <echo
71 level="debug"
72 message="classname: ${classname}"/>
73 <echo
david_williams23f58d72009-11-19 01:35:57 +000074 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000075 message="extraVMargs: ${extraVMargs}"/>
76 <echo
77 level="debug"
78 message="timeout: ${timeout}"/>
79 <echo
80 level="debug"
81 message="testRoot: ${testRoot}"/>
82 <echo
83 level="debug"
84 message="basedir: ${basedir}"/>
85 <echo
86 level="debug"
87 message="eclipse-home: ${eclipse-home}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000088 <echo
david_williams70fc7b42009-11-23 01:08:04 +000089 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000090 message="junit-report-output: ${junit-report-output}"/>
91 <echo
david_williams70fc7b42009-11-23 01:08:04 +000092 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000093 message="test-output: ${test-output}"/>
94 <echo
david_williams70fc7b42009-11-23 01:08:04 +000095 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000096 message="buildDirectory: ${buildDirectory}"/>
97 <echo
david_williams70fc7b42009-11-23 01:08:04 +000098 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000099 message="buildLabel: ${buildLabel}"/>
100 <echo
david_williams70fc7b42009-11-23 01:08:04 +0000101 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +0000102 message="jvm: ${jvm}"/>
103 </target>
104 <target
105 name="core-test"
106 depends="init">
107 <echo
108 level="info"
109 message="test-type: core-test"/>
110 <ant
111 antfile="${ant.file}"
112 dir="${currentDir}"
113 target="eclipse-test">
114 <property
115 name="application"
116 value="org.eclipse.test.coretestapplication"/>
117 </ant>
118 </target>
119 <target
120 name="ui-test"
121 depends="init">
122 <echo
123 level="info"
124 message="test-type: ui-test"/>
125 <ant
126 antfile="${ant.file}"
127 dir="${currentDir}"
128 target="eclipse-test">
129 <property
130 name="application"
131 value="org.eclipse.test.uitestapplication"/>
132 </ant>
133 </target>
134 <target
135 name="eclipse-test"
136 description="Runs the specified classname as a plug-in test.">
137 <echo
138 level="info"
139 message="Running ${classname}"/>
140 <echo
david_williams70fc7b42009-11-23 01:08:04 +0000141 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +0000142 message="Result file: ${junit-report-output}/${classname}.xml."/>
143 <echo
144 level="debug"
145 message="DISPLAY: ${env.DISPLAY}"/>
david_williamsdb9eed92009-11-18 20:03:49 +0000146 <mkdir
147 dir="${buildDirectory}/${buildLabel}/httplogstest"/>
148 <echo
149 message="http log messages to: ${buildDirectory}/${buildLabel}/httplogstest"/>
david_williams05fbdde2009-11-21 20:14:13 +0000150
151 <condition
152 property="xulRunnerParam"
153 value="org.eclipse.swt.browser.XULRunnerPath"
154 else="XULRunnerPathNotSpecified">
155 <isset
156 property="env.WTP_XULRUNNER"/>
157 </condition>
david_williams6561c722009-11-19 04:00:59 +0000158 <echo
159 message="xulRunnerParam: ${xulRunnerParam}"/>
160 <echo
161 message="WTP_XULRUNNER: ${env.WTP_XULRUNNER}"/>
david_williamsb0673b02009-11-23 01:39:54 +0000162
163 <echo message="redirected output: ${junit-report-output}/${classname}.output.txt" />
164 <echo message="redirected error: ${junit-report-output}/${classname}.error.txt" />
165
166
david_williams0ecd8ec2009-11-09 04:16:21 +0000167 <!--
168 If there is not exactly one launcher in the stack, we'd best
169 fail fast, since we are not expecting that, and may indicate
170 an installation that would produce unpredictable results
171 -->
172 <!--
173 requires ant 1.7, and at this point, we're running 1.6 from
174 eclipse ... <condition property="expectedNumberOfLaunchers">
175 <resourcecount when="equal" count="1" > <fileset
176 dir="${testRoot}/eclipse/plugins"> <include
177 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
178 </resourcecount> </condition> <fail message="Did not find
179 expected number of launcher jars. Check installation."
180 unless="expectedNumberOfLaunchers" />
181 -->
182 <java
183 taskname="suiteUnitTest"
184 fork="true"
185 resultProperty="suitejunitresult"
186 failonerror="false"
187 timeout="${timeout}"
188 dir="${testRoot}/eclipse"
189 jvm="${jvm}"
190 classname="org.eclipse.equinox.launcher.Main">
191 <classpath>
192 <fileset
193 dir="${testRoot}/eclipse/plugins">
194 <include
195 name="org.eclipse.equinox.launcher_*.jar"/>
196 </fileset>
197 </classpath>
198 <jvmarg
david_williams91d6b762009-11-23 00:24:27 +0000199 value="-Xmx256m"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000200 <jvmarg
201 value="-Dosgi.ws=${env.BASEWS}"/>
202 <jvmarg
203 value="-Dosgi.os=${env.BASEOS}"/>
204 <jvmarg
205 value="-Dosgi.arch=${env.BASEARCH}"/>
206 <jvmarg
207 value="-DbuildLabel=${buildLabel}"/>
208 <jvmarg
209 value="-DbuildDirectory=${buildDirectory}"/>
210 <jvmarg
211 value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol"/>
212 <jvmarg
david_williamsdb9eed92009-11-18 20:03:49 +0000213 value="-DurlLogLocation=${buildDirectory}/${buildLabel}/httplogstest/outgoinghttplog-${plugin-name}.log"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000214 <jvmarg
215 value="-Dwtp.autotest.noninteractive=true"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000216 <jvmarg
david_williams05fbdde2009-11-21 20:14:13 +0000217 line="${extraVMargs}"/>
david_williamsdb9eed92009-11-18 20:03:49 +0000218 <jvmarg
219 value="-Declipse.consolelog=true"/>
220 <jvmarg
221 value="-Dosgi.debug"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000222 <jvmarg
223 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
224 <jvmarg
225 value="-Dprojectname=${projectname}"/>
david_williams05fbdde2009-11-21 20:14:13 +0000226
227 <jvmarg
228 value="-D${xulRunnerParam}=${env.WTP_XULRUNNER}"/>
229
230
david_williams0ecd8ec2009-11-09 04:16:21 +0000231 <arg
232 value="-nosplash"/>
233 <arg
david_williams70fc7b42009-11-23 01:08:04 +0000234 value="-consolelog"/>
235 <arg
236 value="-consolelog"/>
david_williams91d6b762009-11-23 00:24:27 +0000237 <arg
david_williams0ecd8ec2009-11-09 04:16:21 +0000238 value="-data"/>
239 <arg
240 value="${data-dir}"/>
241 <arg
242 value="-application"/>
243 <arg
244 value="${application}"/>
245 <arg
246 value="formatter=${formatter},${test-output}"/>
247 <arg
248 value="-testPluginName"/>
249 <arg
250 value="${plugin-name}"/>
251 <arg
252 value="-className"/>
253 <arg
254 value="${classname}"/>
255 <env
256 key="DISPLAY"
257 value="${env.DISPLAY}"/>
258 <redirector
259 output="${junit-report-output}/${classname}.output.txt"
260 error="${junit-report-output}/${classname}.error.txt"/>
261 </java>
262 <echo
263 level="info"
david_williamsb0673b02009-11-23 01:39:54 +0000264 message="suitejunitresult: ${v200911192003}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000265 <antcall
266 target="summarizeFailure"/>
267 <antcall
268 target="collect-results"/>
269 </target>
270 <target
271 name="collect-results">
272 <dirname
273 property="output-dir"
274 file="${test-output}"/>
275 <basename
276 property="output-file-name"
277 file="${test-output}"/>
278 <mkdir
279 dir="${junit-report-output}/xml"/>
280 <junitreport
281 todir="${junit-report-output}/xml"
282 tofile="${classname}.xml">
283 <fileset
284 dir="${output-dir}">
285 <include
286 name="${output-file-name}"/>
287 </fileset>
288 </junitreport>
289 <mkdir
290 dir="${junit-report-output}/html"/>
291 <xslt
292 style="${testRoot}/JUNIT.XSL"
293 basedir="${junit-report-output}"
294 includes="${classname}.xml"
295 destdir="${junit-report-output}/html"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000296 </target>
david_williams0ecd8ec2009-11-09 04:16:21 +0000297 <target
298 name="collect">
299 <!--
300 deprecated, each test.xml uses it, and we should remove,
301 eventually
302 -->
david_williamsdb9eed92009-11-18 20:03:49 +0000303 <echo
304 message="Deprecated. There is no need to call the collect task. It no longer does anything. Please remove from your test.xml file"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000305 </target>
306 <target
307 name="summarizeFailure"
308 depends="checkFailure"
309 if="doFailure">
310 <echo
311 append="true"
312 file="${buildDirectory}/junitFailureList.log">${plugin-name}${line.separator}</echo>
313 </target>
314 <target
315 name="checkFailure">
316 <condition
317 property="doFailure">
318 <not>
319 <equals
320 arg1="${suitejunitresult}"
321 arg2="0"
322 trim="true"/>
323 </not>
324 </condition>
325 </target>
326</project>