blob: ec51308c2bdc711bbebc24866bb1de58e543f356 [file] [log] [blame]
david_williams0ecd8ec2009-11-09 04:16:21 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
4 <!--
5 Note to be cross-platform, "environment variables" are only
6 appropriate for some variables, e.g. ones we set, since
7 properties are case sensitive, even if the environment variables
8 on your operating system are not, e.g. it will be ${env.Path}
9 not ${env.PATH} on Windows
10 -->
david_williams2398e362011-03-05 02:45:39 +000011 <property environment="env"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000012 <fail
13 message="testRoot must be set for this task"
14 unless="testRoot"/>
david_williams3cf93412010-10-04 04:31:27 +000015 <!-- required to get proper value of branch specific values -->
david_williams0ecd8ec2009-11-09 04:16:21 +000016 <property
17 name="keyCfgFile"
18 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
19 <echo
david_williams14cadd12011-03-23 06:43:39 +000020 level="debug"
david_williams0ecd8ec2009-11-09 04:16:21 +000021 message="keyCfgFile: ${keyCfgFile}"/>
david_williams2398e362011-03-05 02:45:39 +000022 <property file="${keyCfgFile}"/>
david_williams05fbdde2009-11-21 20:14:13 +000023
24
25 <!--
david_williamsdb9eed92009-11-18 20:03:49 +000026 typcially already set, but in case of standalone tests, may not
27 be
28 -->
29 <property
30 name="buildLabel"
31 value="${buildType}-${buildId}-${timestamp}"/>
32
33
34 <!--
david_williams9e7f5842011-03-06 03:32:03 +000035 Steps to do after the build is done.
36 -->
david_williams2398e362011-03-05 02:45:39 +000037 <target name="test">
david_williams0ecd8ec2009-11-09 04:16:21 +000038 <dirname
39 file="${ant.file}"
40 property="currentDirectory"/>
41 <ant
42 antfile="${ant.file}"
43 target="runTest"
44 dir="${currentDirectory}"/>
45 </target>
46
47 <!--
david_williams9e7f5842011-03-06 03:32:03 +000048 Steps to do to test the build results
david_williams0ecd8ec2009-11-09 04:16:21 +000049 -->
david_williams2398e362011-03-05 02:45:39 +000050 <target name="runTest">
david_williams0ecd8ec2009-11-09 04:16:21 +000051 <dirname
52 file="${ant.file}"
53 property="test.component.dir"/>
david_williams2398e362011-03-05 02:45:39 +000054 <ant antfile="${wtp.builder.home}/scripts/build/label.xml"/>
55 <property file="${buildDirectory}/label.properties"/>
56 <property file="${wtp.builder.home}/build.properties"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000057 <fail
58 message="testRoot must be set for this task"
59 unless="testRoot"/>
david_williams2398e362011-03-05 02:45:39 +000060 <mkdir dir="${testRoot}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000061
62 <!-- if results already exist, delete them -->
63 <delete
david_williams14cadd12011-03-23 06:43:39 +000064 quiet="true"
david_williams0ecd8ec2009-11-09 04:16:21 +000065 dir="${testRoot}/results"
66 failOnError="false"/>
david_williams2398e362011-03-05 02:45:39 +000067 <mkdir dir="${testRoot}/results"/>
68 <mkdir dir="${testRoot}/results/consolelogs"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000069 <copy
70 todir="${testRoot}"
71 overwrite="true">
david_williams2398e362011-03-05 02:45:39 +000072 <fileset dir="${test.component.dir}/testScripts"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000073 </copy>
david_williams14cadd12011-03-23 06:43:39 +000074 <echo level="debug" message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williamsf46c7712010-08-08 01:58:59 +000075
david_williams082b91e2009-11-23 04:19:20 +000076 <property
77 name="dependency.properties"
david_williamsf46c7712010-08-08 01:58:59 +000078 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
david_williams082b91e2009-11-23 04:19:20 +000079 <available
80 file="${dependency.properties}"
81 property="dependency.properties.exists"/>
82 <fail
83 message="dependency file not found: ${dependency.properties}"
84 unless="dependency.properties.exists"/>
david_williams7e568c72010-09-12 09:04:15 +000085 <property
86 name="test.dependency"
david_williamsf807aa02010-09-27 02:09:52 +000087 value="${wtp.builder.home}/scripts/dependency/dependency.xml"/>
david_williams7e568c72010-09-12 09:04:15 +000088 <available
89 file="${test.dependency}"
90 property="test.dependency.exists"/>
91 <fail
92 message="test dependency file not found: ${test.dependency}"
93 unless="test.dependency.exists"/>
david_williams14cadd12011-03-23 06:43:39 +000094 <echo level="debug" message="test.dependency file: ${test.dependency}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +000095 <ant
david_williamseaaff152010-08-05 00:30:16 +000096 antfile="${test.dependency}"
david_williams0ecd8ec2009-11-09 04:16:21 +000097 target="get">
98 <property
david_williams0ecd8ec2009-11-09 04:16:21 +000099 name="base.install.dir"
100 value="${testRoot}"/>
david_williams5e5f04f2011-03-07 20:07:42 +0000101
david_williamsba00a342011-03-12 05:11:19 +0000102
david_williamsf807aa02010-09-27 02:09:52 +0000103 <property
104 name="tobeinstalled.properties"
david_williams5e5f04f2011-03-07 20:07:42 +0000105 value="${buildDirectory}/maps/${env.RELENG}/distribution/${build.distribution}.tests/tobeInstalled.properties"/>
106
david_williamsb75b9792010-09-27 02:58:32 +0000107 <property
david_williams2398e362011-03-05 02:45:39 +0000108 name="installWorkingDirectory"
109 value="${testRoot}"/>
110
111
112
david_williams0ecd8ec2009-11-09 04:16:21 +0000113 </ant>
david_williams2398e362011-03-05 02:45:39 +0000114 <antcall target="installTests"/>
115 <antcall target="runTestEclipse">
david_williams0ecd8ec2009-11-09 04:16:21 +0000116 <param
117 name="testTarget"
118 value="all"/>
119 </antcall>
david_williams2398e362011-03-05 02:45:39 +0000120 <antcall target="postRunTestEclipse">
david_williams0ecd8ec2009-11-09 04:16:21 +0000121 <param
122 name="testTarget"
123 value="all"/>
124 </antcall>
125 </target>
david_williams3cf93412010-10-04 04:31:27 +0000126
david_williams2398e362011-03-05 02:45:39 +0000127 <target name="installTests">
david_williams3cf93412010-10-04 04:31:27 +0000128
david_williams9e7f5842011-03-06 03:32:03 +0000129 <!-- hard code for now
david_williams3cf93412010-10-04 04:31:27 +0000130 <antcall
131 target="installTestsFromZips">
132 <param
133 name="compName"
134 value="patches32x"/>
135 </antcall>
136 -->
david_williams2398e362011-03-05 02:45:39 +0000137 <antcall target="installTestsFromRepo">
138 </antcall>
139
david_williams3cf93412010-10-04 04:31:27 +0000140
141 </target>
142
143 <target
144 name="installTestsFromZips"
145 depends="init">
david_williams9e7f5842011-03-06 03:32:03 +0000146
147 <!-- a bit hard coded here, will need work for general case -->
david_williams3cf93412010-10-04 04:31:27 +0000148 <property
149 name="zipFile"
150 value="${compName}-${buildLabel}.zip"/>
151
david_williams9e7f5842011-03-06 03:32:03 +0000152
david_williams3cf93412010-10-04 04:31:27 +0000153 <!--
154 We use the exec method for unzip, so we won't fail if a
155 prereq can not be unzipped for some reason. See
156 https://bugs.eclipse.org/bugs/show_bug.cgi?id=283968
157-->
david_williams2398e362011-03-05 02:45:39 +0000158 <mkdir dir="${install.destination}"/>
david_williams3cf93412010-10-04 04:31:27 +0000159 <exec
160 dir="."
161 executable="unzip">
david_williams2398e362011-03-05 02:45:39 +0000162 <arg line="-o -qq ${buildDirectory}/${buildLabel}/${zipFile} -d ${install.destination}/${compName}"/>
david_williams3cf93412010-10-04 04:31:27 +0000163 </exec>
164
165 </target>
166
david_williams2398e362011-03-05 02:45:39 +0000167 <target name="installTestsFromRepo">
david_williams91479c12010-09-27 04:18:21 +0000168
david_williams586c05f2010-09-19 06:54:10 +0000169 <java
170 taskname="p2Director Install"
171 fork="true"
172 resultProperty="p2DirectorInstallResult"
173 failonerror="false"
174 timeout="${testTimeLimit}"
175 dir="${testRoot}"
176 jvm="${env.JAVA_6_HOME}/bin/java"
177 classname="org.eclipse.equinox.launcher.Main">
178 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000179 <fileset dir="${testRoot}/eclipse/plugins">
180 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams586c05f2010-09-19 06:54:10 +0000181 </fileset>
182 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000183 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
184 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
185 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
186 <arg value="-nosplash"/>
187 <arg value="-debug"/>
188 <arg value="-consolelog"/>
189 <arg value="-data"/>
190 <arg value="${testRoot}/p2DirectorInstall"/>
191 <arg value="-application"/>
192 <arg value="org.eclipse.equinox.p2.director"/>
193 <arg value="-destination"/>
194 <arg value="${testRoot}/eclipse"/>
david_williams586c05f2010-09-19 06:54:10 +0000195
david_williams2398e362011-03-05 02:45:39 +0000196 <arg value="-repository"/>
197 <arg value="file://${buildDirectory}/${buildLabel}/repository/,file://${buildDirectory}/${buildLabel}/repositoryunittests/"/>
198 <arg value="-installIU"/>
199 <arg value="${jsdtFeatureIUs},${jsdtTestFeatureIUs}"/>
david_williams586c05f2010-09-19 06:54:10 +0000200
201 <!-- make sure our forked env has a DISPLAY -->
202 <env
203 key="DISPLAY"
204 value="${env.DISPLAY}"/>
205 <redirector
206 output="${testRoot}/results/fullOutput.txt"
207 error="${testRoot}/results/fullErrorLog.txt"/>
208
209 </java>
david_williams9e7f5842011-03-06 03:32:03 +0000210 <!-- If the task succeeds, this ouput log won't be that relevent ... (can be make better in future ... but for now we'll make a copy,
211 just in case we need it -->
david_williams14cadd12011-03-23 06:43:39 +0000212 <echo level="debug" message="p2DirectorInstallResult: ${p2DirectorInstallResult}"/>
david_williams586c05f2010-09-19 06:54:10 +0000213
david_williams2398e362011-03-05 02:45:39 +0000214 <condition property="p2DirectorInstallFailed">
david_williams586c05f2010-09-19 06:54:10 +0000215 <not>
216 <equals
217 arg1="0"
218 arg2="${p2DirectorInstallResult}"/>
219 </not>
220 </condition>
221
222<!-- always copy to test results, even when successful -->
223 <copy
224 file="${testRoot}/results/fullOutput.txt"
225 tofile="${buildDirectory}/${buildLabel}/testResults/p2DirectorInstall.log.txt"
226 overwrite="false"
227 failonerror="false">
228 </copy>
229
david_williams2398e362011-03-05 02:45:39 +0000230 <antcall target="handleFailedInstall"/>
david_williams586c05f2010-09-19 06:54:10 +0000231
232
233 </target>
234 <target
235 name="handleFailedInstall"
236 if="p2DirectorInstallFailed">
237
david_williams9e7f5842011-03-06 03:32:03 +0000238 <!-- copy to direct location, as a signal (to web pages) it failed and link should be provided -->
david_williams586c05f2010-09-19 06:54:10 +0000239 <copy
240 file="${testRoot}/results/fullOutput.txt"
241 tofile="${buildDirectory}/${buildLabel}/p2DirectorInstall.log.txt"
242 overwrite="false"
243 failonerror="false">
244 </copy>
245
246 <fail
247 message="installation of tests failed. See p2DirectorInstall.log.txt."
248 if="p2DirectorInstallResult"/>
249
david_williams0ecd8ec2009-11-09 04:16:21 +0000250 </target>
251 <!--
252 time out may need to be set/adjust for api or performance tests?
253 This testTimeLimit is the whole, overall limit on tests. There's
254 a shorter one for individual suites. some common values, of
david_williams082b91e2009-11-23 04:19:20 +0000255 milliseconds to more recognizable units:
256 14400000: 4 hours
257 7200000: 2 hours
258 3600000: 1 hour
259 1800000: 30 minutes
260 600000: 10 minutes
david_williams0ecd8ec2009-11-09 04:16:21 +0000261 -->
262 <property
263 name="testTimeLimit"
david_williams082b91e2009-11-23 04:19:20 +0000264 value="1800000"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000265 <property
266 name="testFailOnError"
267 value="false"/>
268 <target
269 name="runTestEclipse"
270 description="Run our JUnit's within an instance of antRunner">
271 <property
272 name="test-vm"
273 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams621a6f12010-09-26 08:34:59 +0000274 <!--
david_williams0ecd8ec2009-11-09 04:16:21 +0000275 set path to eclipse folder. If local folder, use '.';
276 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
277 -->
278 <property
279 name="eclipse.home"
280 value="${testRoot}"/>
david_williams14cadd12011-03-23 06:43:39 +0000281 <echo level="debug" message="testTarget: ${testTarget}"/>
david_williams082b91e2009-11-23 04:19:20 +0000282 <!--
283 can not pass in empty values in jvmargs so if not testBundle
284 specified, we'll pass a junk (unused) value
285 -->
286 <condition
287 property="testBundleParam"
288 value="-DtestBundle=${testBundle}"
289 else="-Dunused=nouse">
david_williams2398e362011-03-05 02:45:39 +0000290 <isset property="testBundle"/>
david_williams082b91e2009-11-23 04:19:20 +0000291 </condition>
david_williams621a6f12010-09-26 08:34:59 +0000292
david_williams2398e362011-03-05 02:45:39 +0000293 <echo message="Running junits"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000294 <!--
david_williams082b91e2009-11-23 04:19:20 +0000295 If there is not exactly one launcher in the stack, we'd best
296 fail fast, since we are not expecting that, and may indicate
297 an installation that would produce unpredictable results
298 -->
299 <!--
300 requires ant 1.7, and at this point, we're running 1.6 from
301 eclipse ... <condition property="expectedNumberOfLaunchers">
302 <resourcecount when="equal" count="1" > <fileset
303 dir="${testRoot}/eclipse/plugins"> <include
304 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
305 </resourcecount> </condition> <fail message="Did not find
306 expected number of launcher jars. Check installation."
307 unless="expectedNumberOfLaunchers" />
308 -->
david_williamsef62fc42011-03-18 02:33:39 +0000309
david_williamsba00a342011-03-12 05:11:19 +0000310 <condition
311 property="antQuietValue"
312 value="-quiet"
313 else="">
314 <istrue value="${env.USE_QUIET}"/>
315 </condition>
david_williams0ecd8ec2009-11-09 04:16:21 +0000316 <java
317 taskname="unit-test-masterprocess"
318 fork="true"
319 resultProperty="wtpmasterjunitresult"
320 failonerror="false"
321 timeout="${testTimeLimit}"
322 dir="${testRoot}/eclipse"
323 jvm="${env.JAVA_6_HOME}/bin/java"
324 classname="org.eclipse.equinox.launcher.Main">
325 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000326 <fileset dir="${testRoot}/eclipse/plugins">
327 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000328 </fileset>
david_williams93503712009-11-24 13:49:05 +0000329 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000330 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
331 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
332 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
333 <jvmarg value="-Dws=${env.BASEWS}"/>
334 <jvmarg value="-Dos=${env.BASEOS}"/>
335 <jvmarg value="-Darch=${env.BASEARCH}"/>
336 <jvmarg value="-DbuildBranch=${buildBranch}"/>
337 <jvmarg value="-DbuildType=${buildType}"/>
338 <jvmarg value="-DdependencyFileLocation=${dependencyFileLocation}"/>
339 <jvmarg value="-DbuildId=${buildId}"/>
340 <jvmarg value="-Dprojectname=${projectname}"/>
341 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
342 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
343 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
344 <jvmarg value="${testBundleParam}"/>
345 <arg value="-nosplash"/>
346 <arg value="-consolelog"/>
347 <arg value="-data"/>
348 <arg value="${testRoot}/overallTestWorkspace"/>
349 <arg value="-application"/>
350 <arg value="org.eclipse.ant.core.antRunner"/>
david_williamsba00a342011-03-12 05:11:19 +0000351 <arg value="${antQuietValue}"/>
david_williams2398e362011-03-05 02:45:39 +0000352 <arg value="-logger"/>
353 <arg value="org.apache.tools.ant.DefaultLogger"/>
354 <arg value="-file"/>
355 <arg value="${testRoot}/test.xml"/>
356 <arg value="${testTarget}"/>
david_williams082b91e2009-11-23 04:19:20 +0000357
358 <!-- make sure our forked env has a DISPLAY -->
david_williams0ecd8ec2009-11-09 04:16:21 +0000359 <env
360 key="DISPLAY"
361 value="${env.DISPLAY}"/>
362 <redirector
363 output="${testRoot}/results/fullOutput.txt"
364 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2398e362011-03-05 02:45:39 +0000365 <jvmarg value="-Dbuild.home=${env.BUILD_HOME}"/>
366 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
367 <jvmarg value="-DbuildLabel=${buildLabel}"/>
368 <jvmarg value="-DbaseLocation=${baseLocation}"/>
369 <jvmarg value="-DtestRoot=${testRoot}"/>
370 <jvmarg value="-DtestDir=${testRoot}"/>
371 <jvmarg value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williams3cf93412010-10-04 04:31:27 +0000372 <!--
373 <!- - IBM_JAVA_OPTIONS contains JIT work arounds for bug
374 284441 - -> <env key="IBM_JAVA_OPTIONS"
375 value="-Xjit:{org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.primGetNextToken()Ljava/lang/String;}(disableLookahead),{org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.primGetNextToken()Ljava/lang/String;}(disableLookahead)"/>
376 -->
david_williams0ecd8ec2009-11-09 04:16:21 +0000377 </java>
david_williams2398e362011-03-05 02:45:39 +0000378 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000379 </target>
david_williams2398e362011-03-05 02:45:39 +0000380 <target name="postRunTestEclipse">
david_williams0ecd8ec2009-11-09 04:16:21 +0000381 <copy
382 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
383 overwrite="true"
384 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000385 <fileset dir="${testRoot}/results">
386 <include name="*output.txt"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000387 </fileset>
388 </copy>
389 <copy
390 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
391 overwrite="true"
392 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000393 <fileset dir="${testRoot}/results">
394 <include name="*error.txt"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000395 </fileset>
396 </copy>
397 <copy
398 file="${testRoot}/results/fullOutput.txt"
399 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
400 overwrite="true"
401 failonerror="false">
402 </copy>
403 <copy
404 file="${testRoot}/results/fullErrorLog.txt"
405 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
406 overwrite="true"
407 failonerror="false">
408 </copy>
409 <copy
410 todir="${buildDirectory}/${buildLabel}/testResults/xml"
411 overwrite="true"
412 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000413 <fileset dir="${testRoot}/results/xml">
414 <include name="*.xml"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000415 </fileset>
416 </copy>
417 <copy
418 todir="${buildDirectory}/${buildLabel}/testResults/html"
419 overwrite="true"
420 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000421 <fileset dir="${testRoot}/results/html">
422 <include name="*.html"/>
david_williams0ecd8ec2009-11-09 04:16:21 +0000423 </fileset>
424 </copy>
david_williamsefc103a2011-09-25 04:57:53 +0000425 <copy
426 todir="${buildDirectory}/${buildLabel}/testResults/httplogstest"
427 overwrite="true"
428 failonerror="false">
429 <fileset dir="${testRoot}/results/httplogstest">
430 <include name="*.log"/>
431 </fileset>
432 </copy>
433 <copy
david_williams7e568c72010-09-12 09:04:15 +0000434 todir="${buildDirectory}/${buildLabel}/testResults/"
435 overwrite="true"
436 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000437 <fileset dir="${testRoot}/results/">
438 <include name="*.html"/>
david_williams7e568c72010-09-12 09:04:15 +0000439 </fileset>
440 </copy>
david_williams0ecd8ec2009-11-09 04:16:21 +0000441 </target>
david_williams3cf93412010-10-04 04:31:27 +0000442
david_williams2398e362011-03-05 02:45:39 +0000443 <target name="init">
david_williams3cf93412010-10-04 04:31:27 +0000444
david_williams14cadd12011-03-23 06:43:39 +0000445 <echo level="debug" message="dropinsFolder: ${dropinsFolder} "/>
david_williams3cf93412010-10-04 04:31:27 +0000446 <condition
447 property="install.destination"
448 value="${testRoot}${dropinsFolder}/"
449 else="${testRoot}/eclipse">
david_williams2398e362011-03-05 02:45:39 +0000450 <isset property="dropinsFolder"/>
david_williams3cf93412010-10-04 04:31:27 +0000451 </condition>
452
453 </target>
454
david_williams0ecd8ec2009-11-09 04:16:21 +0000455</project>