blob: fff71781d23ade972096bebcc92e37c34b4a3b44 [file] [log] [blame]
david_williams0ecd8ec2009-11-09 04:16:21 +00001<?xml version="1.0"?>
2<project
3 name="JUnit tests"
4 basedir=".">
david_williams2398e362011-03-05 02:45:39 +00005 <property environment="env"/>
david_williams3cf93412010-10-04 04:31:27 +00006
7 <!-- required to get proper value of branch specific properties -->
david_williams0ecd8ec2009-11-09 04:16:21 +00008 <property
9 name="keyCfgFile"
10 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
11 <echo
david_williams082b91e2009-11-23 04:19:20 +000012 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000013 message="keyCfgFile: ${keyCfgFile}"/>
david_williams2398e362011-03-05 02:45:39 +000014 <property file="${keyCfgFile}"/>
15 <target name="init">
david_williams0ecd8ec2009-11-09 04:16:21 +000016 <property
17 name="junit-report-output"
18 value="${testRoot}/results"/>
david_williams2398e362011-03-05 02:45:39 +000019 <mkdir dir="${junit-report-output}/raw"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000020 <!--
david_williamsdb9eed92009-11-18 20:03:49 +000021 if not otherwise set, be sure extraVMargs is at least some
david_williams082b91e2009-11-23 04:19:20 +000022 string, even if unused string.
david_williams9e7f5842011-03-06 03:32:03 +000023
david_williams082b91e2009-11-23 04:19:20 +000024 Remember, though, extraVMArgs can contain more than one extra arg,
25 so much be passed to VM as a "line", not "value".
david_williams0ecd8ec2009-11-09 04:16:21 +000026 -->
27 <property
28 name="extraVMargs"
david_williams05fbdde2009-11-21 20:14:13 +000029 value="-DextraVMargsunused=notused"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000030
31 <!-- if not otherwise set, use a unique workspace name -->
32 <property
33 name="data-dir"
34 value="${testRoot}/junitworkspaces/workspace-${classname}"/>
david_williamsc9b2f502009-11-24 08:02:51 +000035
david_williamsdb9eed92009-11-18 20:03:49 +000036 <!--
david_williams082b91e2009-11-23 04:19:20 +000037 Some common values, of milliseconds to more recognizable units:
38 14400000: 4 hours
39 7200000: 2 hours
40 3600000: 1 hour
41 1800000: 30 minutes
42 600000: 10 minutes
david_williamsdb9eed92009-11-18 20:03:49 +000043 -->
david_williams0ecd8ec2009-11-09 04:16:21 +000044 <property
45 name="timeout"
46 value="1800000"/>
47 <property
48 name="junit-report-output"
49 value="${junit-report-output}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000050 <property
51 name="formatter"
52 value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
53 <property
54 name="test-output"
55 value="${junit-report-output}/raw/${classname}.xml"/>
56 <property
57 name="jvm"
58 value="${env.JAVA_6_HOME}/bin/java"/>
59 <dirname
60 file="${ant.file}"
61 property="currentDir"/>
62 <echo
david_williams402249e2009-11-23 21:02:39 +000063 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000064 message="data-dir: ${data-dir}"/>
65 <echo
david_williams402249e2009-11-23 21:02:39 +000066 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000067 message="plugin-name: ${plugin-name}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000068 <echo
david_williams402249e2009-11-23 21:02:39 +000069 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000070 message="classname: ${classname}"/>
71 <echo
david_williams23f58d72009-11-19 01:35:57 +000072 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000073 message="extraVMargs: ${extraVMargs}"/>
74 <echo
david_williams1543a9b2009-11-24 01:43:55 +000075 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000076 message="timeout: ${timeout}"/>
77 <echo
david_williams1543a9b2009-11-24 01:43:55 +000078 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000079 message="testRoot: ${testRoot}"/>
80 <echo
david_williams1543a9b2009-11-24 01:43:55 +000081 level="info"
david_williams904dc3f2009-11-24 13:41:49 +000082 message="ant file basedir: ${basedir}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000083 <echo
david_williams70fc7b42009-11-23 01:08:04 +000084 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000085 message="junit-report-output: ${junit-report-output}"/>
86 <echo
david_williams70fc7b42009-11-23 01:08:04 +000087 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000088 message="test-output: ${test-output}"/>
89 <echo
david_williams70fc7b42009-11-23 01:08:04 +000090 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000091 message="buildDirectory: ${buildDirectory}"/>
92 <echo
david_williams70fc7b42009-11-23 01:08:04 +000093 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000094 message="buildLabel: ${buildLabel}"/>
95 <echo
david_williams70fc7b42009-11-23 01:08:04 +000096 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +000097 message="jvm: ${jvm}"/>
98 </target>
99 <target
100 name="core-test"
101 depends="init">
102 <echo
103 level="info"
104 message="test-type: core-test"/>
105 <ant
106 antfile="${ant.file}"
107 dir="${currentDir}"
108 target="eclipse-test">
109 <property
110 name="application"
111 value="org.eclipse.test.coretestapplication"/>
112 </ant>
113 </target>
114 <target
115 name="ui-test"
116 depends="init">
117 <echo
118 level="info"
119 message="test-type: ui-test"/>
120 <ant
121 antfile="${ant.file}"
122 dir="${currentDir}"
123 target="eclipse-test">
124 <property
125 name="application"
126 value="org.eclipse.test.uitestapplication"/>
127 </ant>
128 </target>
129 <target
130 name="eclipse-test"
131 description="Runs the specified classname as a plug-in test.">
132 <echo
133 level="info"
134 message="Running ${classname}"/>
135 <echo
david_williams70fc7b42009-11-23 01:08:04 +0000136 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +0000137 message="Result file: ${junit-report-output}/${classname}.xml."/>
138 <echo
david_williams1543a9b2009-11-24 01:43:55 +0000139 level="info"
david_williams0ecd8ec2009-11-09 04:16:21 +0000140 message="DISPLAY: ${env.DISPLAY}"/>
david_williams2398e362011-03-05 02:45:39 +0000141 <mkdir dir="${junit-report-output}/httplogstest"/>
142 <echo message="http log messages to: ${junit-report-output}/httplogstest"/>
david_williams36839e52009-11-23 02:33:12 +0000143 <condition
144 property="xulRunnerParam"
145 value="org.eclipse.swt.browser.XULRunnerPath"
146 else="XULRunnerPathNotSpecified">
david_williams2398e362011-03-05 02:45:39 +0000147 <isset property="env.WTP_XULRUNNER"/>
david_williams36839e52009-11-23 02:33:12 +0000148 </condition>
david_williams2398e362011-03-05 02:45:39 +0000149 <echo message="xulRunnerParam: ${xulRunnerParam}"/>
150 <echo message="WTP_XULRUNNER: ${env.WTP_XULRUNNER}"/>
151 <echo message="redirected output: ${junit-report-output}/${classname}.output.txt"/>
152 <echo message="redirected error: ${junit-report-output}/${classname}.error.txt"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000153 <!--
154 If there is not exactly one launcher in the stack, we'd best
155 fail fast, since we are not expecting that, and may indicate
156 an installation that would produce unpredictable results
157 -->
158 <!--
159 requires ant 1.7, and at this point, we're running 1.6 from
160 eclipse ... <condition property="expectedNumberOfLaunchers">
161 <resourcecount when="equal" count="1" > <fileset
162 dir="${testRoot}/eclipse/plugins"> <include
163 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
164 </resourcecount> </condition> <fail message="Did not find
165 expected number of launcher jars. Check installation."
166 unless="expectedNumberOfLaunchers" />
167 -->
168 <java
169 taskname="suiteUnitTest"
170 fork="true"
171 resultProperty="suitejunitresult"
172 failonerror="false"
173 timeout="${timeout}"
174 dir="${testRoot}/eclipse"
175 jvm="${jvm}"
176 classname="org.eclipse.equinox.launcher.Main">
177 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000178 <fileset dir="${testRoot}/eclipse/plugins">
179 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000180 </fileset>
181 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000182 <jvmarg value="-Xmx758m"/>
183 <jvmarg value="-Xverify"/>
184 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
185 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
186 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
187 <jvmarg value="-DbuildLabel=${buildLabel}"/>
188 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
david_williams204cb1e2011-09-25 04:34:37 +0000189 <jvmarg value="-Djava.protocol.handler.pkgs=org.eclipse.wtp.releng.www.protocol"/>
david_williams2398e362011-03-05 02:45:39 +0000190 <jvmarg value="-DurlLogLocation=${junit-report-output}/httplogstest/outgoinghttplog-${plugin-name}.log"/>
191 <jvmarg value="-Dwtp.autotest.noninteractive=true"/>
192 <jvmarg line="${extraVMargs}"/>
193 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
194 <jvmarg value="-Dprojectname=${projectname}"/>
195 <jvmarg value="-Djunit-report-output=${junit-report-output}"/>
196 <jvmarg value="-D${xulRunnerParam}=${env.WTP_XULRUNNER}"/>
197 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
198 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
199 <arg value="-nosplash"/>
200 <arg value="-consolelog"/>
201 <arg value="-debug"/>
202 <arg value="-data"/>
203 <arg value="${data-dir}"/>
204 <arg value="-application"/>
205 <arg value="${application}"/>
206 <arg value="formatter=${formatter},${test-output}"/>
207 <arg value="-testPluginName"/>
208 <arg value="${plugin-name}"/>
209 <arg value="-className"/>
210 <arg value="${classname}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000211 <env
212 key="DISPLAY"
213 value="${env.DISPLAY}"/>
214 <redirector
215 output="${junit-report-output}/${classname}.output.txt"
216 error="${junit-report-output}/${classname}.error.txt"/>
217 </java>
218 <echo
219 level="info"
david_williams36839e52009-11-23 02:33:12 +0000220 message="suitejunitresult: ${suitejunitresult}"/>
david_williams2398e362011-03-05 02:45:39 +0000221 <antcall target="summarizeFailure"/>
222 <antcall target="collect-results"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000223 </target>
david_williams2398e362011-03-05 02:45:39 +0000224 <target name="collect-results">
david_williams0ecd8ec2009-11-09 04:16:21 +0000225 <dirname
226 property="output-dir"
227 file="${test-output}"/>
228 <basename
229 property="output-file-name"
230 file="${test-output}"/>
david_williams2398e362011-03-05 02:45:39 +0000231 <mkdir dir="${junit-report-output}/xml"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000232 <junitreport
233 todir="${junit-report-output}/xml"
234 tofile="${classname}.xml">
david_williams2398e362011-03-05 02:45:39 +0000235 <fileset dir="${output-dir}">
236 <include name="${output-file-name}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000237 </fileset>
238 </junitreport>
david_williams2398e362011-03-05 02:45:39 +0000239 <mkdir dir="${junit-report-output}/html"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000240 <xslt
241 style="${testRoot}/JUNIT.XSL"
242 basedir="${junit-report-output}"
243 includes="${classname}.xml"
244 destdir="${junit-report-output}/html"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000245 </target>
david_williams2398e362011-03-05 02:45:39 +0000246 <target name="collect">
david_williams0ecd8ec2009-11-09 04:16:21 +0000247 <!--
248 deprecated, each test.xml uses it, and we should remove,
249 eventually
250 -->
david_williamsdb9eed92009-11-18 20:03:49 +0000251 <echo
252 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 +0000253 </target>
254 <target
255 name="summarizeFailure"
256 depends="checkFailure"
257 if="doFailure">
david_williamsb4d960f2010-04-14 13:58:23 +0000258 <!--
259 TODO: fix sdo junitFailureList.log goes in 'results', at
260 first. Then copied. Then coordinate with releng scripts
261 -->
david_williams0ecd8ec2009-11-09 04:16:21 +0000262 <echo
263 append="true"
264 file="${buildDirectory}/junitFailureList.log">${plugin-name}${line.separator}</echo>
265 </target>
david_williams2398e362011-03-05 02:45:39 +0000266 <target name="checkFailure">
267 <condition property="doFailure">
david_williams0ecd8ec2009-11-09 04:16:21 +0000268 <not>
269 <equals
270 arg1="${suitejunitresult}"
271 arg2="0"
272 trim="true"/>
273 </not>
274 </condition>
275 </target>
276</project>