blob: 9863191d4e5fac31afa60c8bedadaf2cb8036367 [file] [log] [blame]
david_williams331eaf32007-03-17 22:39:31 +00001<?xml version="1.0"?>
david_williams403beae2007-12-09 02:10:40 +00002<project
3 name="JUnit tests"
4 basedir=".">
david_williams5dde2052008-02-12 05:44:11 +00005 <property
6 environment="env" />
david_williamscfd9a4a2008-03-27 16:35:01 +00007
8 <!-- required to get proper value of dropinsFolder -->
9 <property name="keyCfgFile" value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg" />
10 <echo message="keyCfgFile: ${keyCfgFile}" />
11 <property file="${keyCfgFile}" />
david_williams5dde2052008-02-12 05:44:11 +000012 <target
13 name="init">
14 <!--
david_williams403beae2007-12-09 02:10:40 +000015 Parameters:
16 (Mandatory)
17 data-dir - the workspace directory for Eclipse to write its data
18 plugin-name - symboic name of the plugin to test
19 testPlugin - directory name of plugin (with version suffix)
20 classname - the name of the test class
21
22 (Optional - overrides defaults set in script)
23 extraVMargs - allows separate setting of VM args from separate caller.
24 timeout - overrides default test timeout value (in milliseconds).
25 -->
david_williams403beae2007-12-09 02:10:40 +000026 <property
27 name="junit-report-output"
28 value="${testRoot}/results" />
david_williams5dde2052008-02-12 05:44:11 +000029 <mkdir
30 dir="${junit-report-output}/raw" />
david_williams331eaf32007-03-17 22:39:31 +000031
32
david_williams5dde2052008-02-12 05:44:11 +000033 <!-- if not otherwise set, be sure extraVMargs is at least empty string -->
david_williams403beae2007-12-09 02:10:40 +000034 <property
35 name="extraVMargs"
36 value="" />
david_williams5ab33bf2007-03-20 03:15:25 +000037
david_williams5dde2052008-02-12 05:44:11 +000038 <!-- if not otherwise set, use a unique workspace name -->
david_williams403beae2007-12-09 02:10:40 +000039 <property
40 name="data-dir"
41 value="${testRoot}/junitworkspaces/workspace-${classname}" />
david_williams403beae2007-12-09 02:10:40 +000042 <property
43 name="testRoot"
44 value="${testRoot}" />
45 <property
46 name="timeout"
47 value="1800000" />
48 <property
49 name="junit-report-output"
50 value="${junit-report-output}" />
51 <property
52 name="plugin-path"
david_williamsb064ea62008-03-28 00:41:31 +000053 value="${testRoot}/eclipse/dropins/eclipse/plugins/${testPlugin}" />
david_williams403beae2007-12-09 02:10:40 +000054 <property
55 name="formatter"
56 value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter" />
57 <property
58 name="test-output"
59 value="${junit-report-output}/raw/${classname}.xml" />
60 <property
61 name="jvm"
62 value="${env.JAVA_5_HOME}/bin/java" />
david_williams403beae2007-12-09 02:10:40 +000063 <dirname
64 file="${ant.file}"
65 property="currentDir" />
david_williams403beae2007-12-09 02:10:40 +000066 <echo
67 level="debug"
68 message="data-dir: ${data-dir}" />
69 <echo
70 level="debug"
71 message="plugin-name: ${plugin-name}" />
72 <echo
73 level="debug"
74 message="testPlugin: ${testPlugin}" />
75 <echo
76 level="debug"
77 message="classname: ${classname}" />
78 <echo
79 level="debug"
80 message="extraVMargs: ${extraVMargs}" />
81 <echo
82 level="debug"
83 message="timeout: ${timeout}" />
84 <echo
85 level="debug"
86 message="testRoot: ${testRoot}" />
david_williams403beae2007-12-09 02:10:40 +000087 <echo
88 level="debug"
89 message="basedir: ${basedir}" />
90 <echo
91 level="debug"
92 message="eclipse-home: ${eclipse-home}" />
93 <echo
94 level="debug"
95 message="plugin-path: ${plugin-path}" />
96 <echo
97 level="debug"
98 message="junit-report-output: ${junit-report-output}" />
99 <echo
100 level="debug"
101 message="test-output: ${test-output}" />
102 <echo
103 level="debug"
104 message="buildDirectory: ${buildDirectory}" />
105 <echo
106 level="debug"
107 message="buildLabel: ${buildLabel}" />
david_williams403beae2007-12-09 02:10:40 +0000108 <echo
109 level="debug"
110 message="jvm: ${env.JAVA_5_HOME}/bin/java" />
david_williams403beae2007-12-09 02:10:40 +0000111 </target>
david_williams403beae2007-12-09 02:10:40 +0000112 <target
113 name="core-test"
114 depends="init">
115 <echo
116 level="info"
117 message="test-type: core-test" />
118 <ant
119 antfile="${ant.file}"
120 dir="${currentDir}"
121 target="eclipse-test">
122 <property
123 name="application"
124 value="org.eclipse.test.coretestapplication" />
125 </ant>
126 </target>
david_williams403beae2007-12-09 02:10:40 +0000127 <target
128 name="ui-test"
129 depends="init">
130 <echo
131 level="info"
132 message="test-type: ui-test" />
133 <ant
134 antfile="${ant.file}"
135 dir="${currentDir}"
136 target="eclipse-test">
137 <property
138 name="application"
139 value="org.eclipse.test.uitestapplication" />
140 </ant>
141 </target>
david_williams403beae2007-12-09 02:10:40 +0000142 <target
143 name="eclipse-test"
144 description="Runs the specified classname as a plug-in test.">
david_williams403beae2007-12-09 02:10:40 +0000145 <echo
146 level="info"
147 message="Running ${classname}" />
148 <echo
149 level="debug"
150 message="Result file: ${junit-report-output}/${classname}.xml." />
151 <echo
152 level="debug"
153 message="DISPLAY: ${env.DISPLAY}" />
david_williams5ab33bf2007-03-20 03:15:25 +0000154
david_williams5dde2052008-02-12 05:44:11 +0000155 <!-- If there is not exactly one launcher in the stack,
david_williams403beae2007-12-09 02:10:40 +0000156 we'd best fail fast, since we are not expecting that,
157 and may indicate an installation that would produce unpredictable
158 results -->
david_williams5dde2052008-02-12 05:44:11 +0000159 <!-- requires ant 1.7, and at this point, we're running 1.6 from
david_williams403beae2007-12-09 02:10:40 +0000160 eclipse ...
161
162 <condition property="expectedNumberOfLaunchers">
163 <resourcecount when="equal" count="1" >
164 <fileset dir="${testRoot}/eclipse/plugins">
165 <include name="org.eclipse.equinox.launcher_*.jar" />
166 </fileset>
167 </resourcecount>
168 </condition>
169 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
170 -->
171 <java
172 taskname="suiteUnitTest"
173 fork="true"
174 resultProperty="suitejunitresult"
175 failonerror="false"
176 timeout="${timeout}"
177 dir="${testRoot}/eclipse"
178 jvm="${env.JAVA_5_HOME}/bin/java"
179 classname="org.eclipse.equinox.launcher.Main">
180 <classpath>
david_williams5dde2052008-02-12 05:44:11 +0000181 <fileset
182 dir="${testRoot}/eclipse/plugins">
183 <include
184 name="org.eclipse.equinox.launcher_*.jar" />
david_williams403beae2007-12-09 02:10:40 +0000185 </fileset>
186 </classpath>
david_williams5dde2052008-02-12 05:44:11 +0000187 <jvmarg
188 value="-Xms256m" />
189 <jvmarg
190 value="-Xmx1024m" />
191 <jvmarg
192 value="-Dosgi.ws=${env.BASEWS}" />
193 <jvmarg
194 value="-Dosgi.os=${env.BASEOS}" />
195 <jvmarg
196 value="-Dosgi.arch=${env.BASEARCH}" />
197 <jvmarg
198 value="-DbuildLabel=${buildLabel}" />
199 <jvmarg
200 value="-DbuildDirectory=${buildDirectory}" />
201 <jvmarg
202 value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol" />
203 <jvmarg
204 value="-DurlLogLocation=${buildDirectory}/outgoinghttplogfromtests.log" />
205 <jvmarg
206 value="-Dwtp.autotest.noninteractive=true" />
207 <jvmarg
david_williams5dde2052008-02-12 05:44:11 +0000208 value="-DPLUGIN_PATH=${plugin-path}" />
209 <jvmarg
210 line="${extraVMargs}" />
211 <jvmarg
212 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
213 <arg
214 value="-nosplash" />
215 <arg
216 value="-consolelog" />
217 <arg
218 value="-debug" />
219 <arg
220 value="-data" />
221 <arg
222 value="${data-dir}" />
223 <arg
224 value="-application" />
225 <arg
226 value="${application}" />
227 <arg
228 value="formatter=${formatter},${test-output}" />
229 <arg
230 value="-testPluginName" />
231 <arg
232 value="${plugin-name}" />
233 <arg
234 value="-className" />
235 <arg
236 value="${classname}" />
david_williams403beae2007-12-09 02:10:40 +0000237 <env
238 key="DISPLAY"
239 value="${env.DISPLAY}" />
240 <redirector
241 output="${junit-report-output}/${classname}.output.txt"
242 error="${junit-report-output}/${classname}.error.txt" />
243 </java>
david_williams5dde2052008-02-12 05:44:11 +0000244 <echo
245 level="info"
246 message="suitejunitresult: ${suitejunitresult}" />
247 <antcall
248 target="summarizeFailure" />
249 <antcall
250 target="collect-results" />
david_williams403beae2007-12-09 02:10:40 +0000251 </target>
david_williams5dde2052008-02-12 05:44:11 +0000252 <target
253 name="collect-results">
david_williams403beae2007-12-09 02:10:40 +0000254 <dirname
255 property="output-dir"
256 file="${test-output}" />
257 <basename
258 property="output-file-name"
259 file="${test-output}" />
david_williams5dde2052008-02-12 05:44:11 +0000260 <mkdir
261 dir="${junit-report-output}/xml" />
david_williams403beae2007-12-09 02:10:40 +0000262 <junitreport
263 todir="${junit-report-output}/xml"
264 tofile="${classname}.xml">
david_williams5dde2052008-02-12 05:44:11 +0000265 <fileset
266 dir="${output-dir}">
267 <include
268 name="${output-file-name}" />
david_williams403beae2007-12-09 02:10:40 +0000269 </fileset>
270 </junitreport>
david_williams5dde2052008-02-12 05:44:11 +0000271 <mkdir
272 dir="${junit-report-output}/html" />
david_williams6b198a72008-01-26 06:19:56 +0000273 <xslt
david_williams403beae2007-12-09 02:10:40 +0000274 style="${testRoot}/JUNIT.XSL"
275 basedir="${junit-report-output}"
276 includes="${classname}.xml"
277 destdir="${junit-report-output}/html" />
david_williams403beae2007-12-09 02:10:40 +0000278 <copy
279 file="${data-dir}/.metadata/.log"
280 toFile="${testRoot}/results/consolelogs/metadata-logs/${classname}.workspace.log"
281 overwrite="true"
282 failonError="false" />
david_williams5ab33bf2007-03-20 03:15:25 +0000283
david_williams5dde2052008-02-12 05:44:11 +0000284 <!-- todo: this, especially, should be concat (there could be more than one, in theory) -->
david_williams403beae2007-12-09 02:10:40 +0000285 <copy
286 file="${testRoot}/eclipse/configuration/*.log"
287 toFile="${testRoot}/results/consolelogs/configuration-logs/${classname}.config.log"
288 overwrite="true"
289 failonError="false" />
david_williams403beae2007-12-09 02:10:40 +0000290 </target>
david_williams5dde2052008-02-12 05:44:11 +0000291 <target
292 name="collect">
293 <!-- deprecated, each test.xml uses it, and we should remove, eventually -->
david_williams403beae2007-12-09 02:10:40 +0000294 </target>
david_williams5dde2052008-02-12 05:44:11 +0000295 <target
296 name="summarizeFailure"
297 depends="checkFailure"
298 if="doFailure">
299 <echo
300 append="true"
301 file="${buildDirectory}/junitFailureList.log">${plugin-name}${line.separator}</echo>
david_williams6f5ad422008-02-11 02:54:54 +0000302 </target>
david_williams5dde2052008-02-12 05:44:11 +0000303 <target
304 name="checkFailure">
305 <condition
306 property="doFailure">
307 <not>
308 <equals
309 arg1="${suitejunitresult}"
310 arg2="0"
311 trim="true" />
312 </not>
313 </condition>
314 </target>
315</project>