blob: 0b42280820def9d39ac3316ef3ce2ac0aba87220 [file] [log] [blame]
david_williams12def432010-08-09 04:42: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_williams12def432010-08-09 04:42:21 +000012 <fail
13 message="testRoot must be set for this task"
14 unless="testRoot"/>
david_williamsba00a342011-03-12 05:11:19 +000015 <!-- required to get proper value of branch specific values -->
david_williams12def432010-08-09 04:42:21 +000016 <property
17 name="keyCfgFile"
18 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
19 <echo
20 level="info"
21 message="keyCfgFile: ${keyCfgFile}"/>
david_williams2398e362011-03-05 02:45:39 +000022 <property file="${keyCfgFile}"/>
david_williams12def432010-08-09 04:42:21 +000023 <!--
24 typcially already set, but in case of standalone tests, may not
25 be
26 -->
27 <property
28 name="buildLabel"
29 value="${buildType}-${buildId}-${timestamp}"/>
30
31
32 <!--
33 Steps to do after the build is done.
34 -->
david_williams2398e362011-03-05 02:45:39 +000035 <target name="test">
david_williams12def432010-08-09 04:42:21 +000036 <dirname
37 file="${ant.file}"
38 property="currentDirectory"/>
39 <ant
40 antfile="${ant.file}"
41 target="runTest"
42 dir="${currentDirectory}"/>
43 </target>
44
45 <!--
46 Steps to do to test the build results
47 -->
david_williams2398e362011-03-05 02:45:39 +000048 <target name="runTest">
david_williams12def432010-08-09 04:42:21 +000049 <dirname
50 file="${ant.file}"
51 property="test.component.dir"/>
david_williams2398e362011-03-05 02:45:39 +000052 <ant antfile="${wtp.builder.home}/scripts/build/label.xml"/>
53 <property file="${buildDirectory}/label.properties"/>
54 <property file="${wtp.builder.home}/build.properties"/>
david_williams12def432010-08-09 04:42:21 +000055 <fail
56 message="testRoot must be set for this task"
57 unless="testRoot"/>
david_williams2398e362011-03-05 02:45:39 +000058 <mkdir dir="${testRoot}"/>
david_williams12def432010-08-09 04:42:21 +000059
60 <!-- if results already exist, delete them -->
61 <delete
62 dir="${testRoot}/results"
63 failOnError="false"/>
david_williams2398e362011-03-05 02:45:39 +000064 <mkdir dir="${testRoot}/results"/>
65 <mkdir dir="${testRoot}/results/consolelogs"/>
david_williams12def432010-08-09 04:42:21 +000066 <copy
67 todir="${testRoot}"
68 overwrite="true">
david_williams2398e362011-03-05 02:45:39 +000069 <fileset dir="${test.component.dir}/testScripts"/>
david_williams12def432010-08-09 04:42:21 +000070 </copy>
david_williams2398e362011-03-05 02:45:39 +000071 <echo message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williams12def432010-08-09 04:42:21 +000072
73 <property
74 name="dependency.properties"
75 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
76 <available
77 file="${dependency.properties}"
78 property="dependency.properties.exists"/>
79 <fail
80 message="dependency file not found: ${dependency.properties}"
81 unless="dependency.properties.exists"/>
david_williams7e568c72010-09-12 09:04:15 +000082 <property
83 name="test.dependency"
david_williamsba00a342011-03-12 05:11:19 +000084 value="${wtp.builder.home}/scripts/dependency/dependency.xml"/>
david_williams7e568c72010-09-12 09:04:15 +000085 <available
86 file="${test.dependency}"
87 property="test.dependency.exists"/>
88 <fail
89 message="test dependency file not found: ${test.dependency}"
90 unless="test.dependency.exists"/>
david_williamsba00a342011-03-12 05:11:19 +000091 <echo message="test.dependency file: ${test.dependency}"/>
david_williams12def432010-08-09 04:42:21 +000092 <ant
93 antfile="${test.dependency}"
94 target="get">
95 <property
96 name="base.install.dir"
97 value="${testRoot}"/>
david_williamsba00a342011-03-12 05:11:19 +000098 <property
99 name="tobeinstalled.properties"
100 value="${buildDirectory}/maps/${env.RELENG}/distribution/${build.distribution}.tests/tobeInstalled.properties"/>
101
102 <property
103 name="installWorkingDirectory"
104 value="${testRoot}"/>
105
106
107
david_williams12def432010-08-09 04:42:21 +0000108 </ant>
david_williamsba00a342011-03-12 05:11:19 +0000109 <antcall target="installTests"/>
david_williams2398e362011-03-05 02:45:39 +0000110 <antcall target="runTestEclipse">
david_williams12def432010-08-09 04:42:21 +0000111 <param
112 name="testTarget"
113 value="all"/>
114 </antcall>
david_williams2398e362011-03-05 02:45:39 +0000115 <antcall target="postRunTestEclipse">
david_williams12def432010-08-09 04:42:21 +0000116 <param
117 name="testTarget"
118 value="all"/>
119 </antcall>
120 </target>
david_williamsba00a342011-03-12 05:11:19 +0000121
122 <!--
123 note: the 'test.installed' attribute is a temporary hack
124 to allow standalone tests to do the install themselves.
125 Eventually, this script should be improved so this hack would
126 be not required. The "location" of the
127 zips/repos are indirectly currently "hard coded" to
128 be in /projects/... but
129 this should become a variable, sometimes (maybe)
130 set to /projects/...,
131 more often set to some URL from committers or downloads pages.
132 See the repos values below in repo install:
133 value="file://${buildDirectory}/${buildLabel}/repository/,file://${buildDirectory}/${buildLabel}/repositoryunittests/"/>
134 These should be changed to be something like
135 value="${coderepo},${unittestsrepo}"/>
136 Or similar. Then could be set as desired.
137 -->
138 <target
139 name="installTests"
140 unless="test.installed">
141
142 <!-- hard code for now
143 <antcall
144 target="installTestsFromZips">
145 <param
146 name="compName"
147 value="patches32x"/>
148 </antcall>
david_williams12def432010-08-09 04:42:21 +0000149 -->
david_williamsba00a342011-03-12 05:11:19 +0000150 <antcall target="installTestsFromRepo">
151 </antcall>
152
153
154 </target>
155
156 <target
157 name="installTestsFromZips"
158 depends="init">
159
160 <!-- a bit hard coded here, will need work for general case -->
161 <property
162 name="zipFile"
163 value="${compName}-${buildLabel}.zip"/>
164
165
166 <!--
167 We use the exec method for unzip, so we won't fail if a
168 prereq can not be unzipped for some reason. See
169 https://bugs.eclipse.org/bugs/show_bug.cgi?id=283968
170-->
171 <mkdir dir="${install.destination}"/>
172 <exec
173 dir="."
174 executable="unzip">
175 <arg line="-o -qq ${buildDirectory}/${buildLabel}/${zipFile} -d ${install.destination}/${compName}"/>
176 </exec>
177
178 </target>
179
180 <target name="installTestsFromRepo">
181
david_williams12def432010-08-09 04:42:21 +0000182 <java
183 taskname="p2Director Install"
184 fork="true"
185 resultProperty="p2DirectorInstallResult"
david_williamsba00a342011-03-12 05:11:19 +0000186 failonerror="false"
david_williams12def432010-08-09 04:42:21 +0000187 timeout="${testTimeLimit}"
188 dir="${testRoot}"
189 jvm="${env.JAVA_6_HOME}/bin/java"
190 classname="org.eclipse.equinox.launcher.Main">
191 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000192 <fileset dir="${testRoot}/eclipse/plugins">
193 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams12def432010-08-09 04:42:21 +0000194 </fileset>
195 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000196 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williamsba00a342011-03-12 05:11:19 +0000197 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
198 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
david_williams2398e362011-03-05 02:45:39 +0000199 <arg value="-nosplash"/>
200 <arg value="-debug"/>
201 <arg value="-consolelog"/>
202 <arg value="-data"/>
203 <arg value="${testRoot}/p2DirectorInstall"/>
204 <arg value="-application"/>
205 <arg value="org.eclipse.equinox.p2.director"/>
206 <arg value="-destination"/>
207 <arg value="${testRoot}/eclipse"/>
david_williamsba00a342011-03-12 05:11:19 +0000208
david_williams2398e362011-03-05 02:45:39 +0000209 <arg value="-repository"/>
david_williamsba00a342011-03-12 05:11:19 +0000210 <arg value="file://${buildDirectory}/${buildLabel}/repository/,file://${buildDirectory}/${buildLabel}/repositoryunittests/"/>
david_williams2398e362011-03-05 02:45:39 +0000211 <arg value="-installIU"/>
212 <arg value="${wtpFeatureIUs},${testFeatureIUs}"/>
david_williams12def432010-08-09 04:42:21 +0000213
214 <!-- make sure our forked env has a DISPLAY -->
215 <env
216 key="DISPLAY"
217 value="${env.DISPLAY}"/>
218 <redirector
219 output="${testRoot}/results/fullOutput.txt"
220 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams18da1202010-09-23 14:34:24 +0000221
david_williams12def432010-08-09 04:42:21 +0000222 </java>
david_williamsba00a342011-03-12 05:11:19 +0000223 <!-- 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,
224 just in case we need it -->
david_williams2398e362011-03-05 02:45:39 +0000225 <echo message="p2DirectorInstallResult: ${p2DirectorInstallResult}"/>
david_williamsba00a342011-03-12 05:11:19 +0000226
227 <condition property="p2DirectorInstallFailed">
228 <not>
229 <equals
230 arg1="0"
231 arg2="${p2DirectorInstallResult}"/>
232 </not>
233 </condition>
234
235<!-- always copy to test results, even when successful -->
236 <copy
237 file="${testRoot}/results/fullOutput.txt"
238 tofile="${buildDirectory}/${buildLabel}/testResults/p2DirectorInstall.log.txt"
239 overwrite="false"
240 failonerror="false">
241 </copy>
242
243 <antcall target="handleFailedInstall"/>
244
245
246 </target>
247 <target
248 name="handleFailedInstall"
249 if="p2DirectorInstallFailed">
250
251 <!-- copy to direct location, as a signal (to web pages) it failed and link should be provided -->
252 <copy
253 file="${testRoot}/results/fullOutput.txt"
254 tofile="${buildDirectory}/${buildLabel}/p2DirectorInstall.log.txt"
255 overwrite="false"
256 failonerror="false">
257 </copy>
258
259 <fail
260 message="installation of tests failed. See p2DirectorInstall.log.txt."
david_williams12def432010-08-09 04:42:21 +0000261 if="p2DirectorInstallResult"/>
david_williamsba00a342011-03-12 05:11:19 +0000262
david_williams12def432010-08-09 04:42:21 +0000263 </target>
264 <!--
265 time out may need to be set/adjust for api or performance tests?
266 This testTimeLimit is the whole, overall limit on tests. There's
267 a shorter one for individual suites. some common values, of
268 milliseconds to more recognizable units:
269 14400000: 4 hours
270 7200000: 2 hours
271 3600000: 1 hour
272 1800000: 30 minutes
273 600000: 10 minutes
274 -->
275 <property
276 name="testTimeLimit"
277 value="28800000"/>
278 <property
279 name="testFailOnError"
280 value="false"/>
281 <target
282 name="runTestEclipse"
283 description="Run our JUnit's within an instance of antRunner">
284 <property
285 name="test-vm"
286 value="${env.JAVA_6_HOME}/bin/java"/>
287 <!--
288 set path to eclipse folder. If local folder, use '.';
289 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
290 -->
291 <property
292 name="eclipse.home"
293 value="${testRoot}"/>
david_williams2398e362011-03-05 02:45:39 +0000294 <echo message="testTarget: ${testTarget}"/>
david_williams12def432010-08-09 04:42:21 +0000295 <!--
296 can not pass in empty values in jvmargs so if not testBundle
297 specified, we'll pass a junk (unused) value
298 -->
299 <condition
300 property="testBundleParam"
301 value="-DtestBundle=${testBundle}"
302 else="-Dunused=nouse">
david_williams2398e362011-03-05 02:45:39 +0000303 <isset property="testBundle"/>
david_williams12def432010-08-09 04:42:21 +0000304 </condition>
david_williams2398e362011-03-05 02:45:39 +0000305 <echo message="Running junits"/>
david_williams12def432010-08-09 04:42:21 +0000306 <!--
307 If there is not exactly one launcher in the stack, we'd best
308 fail fast, since we are not expecting that, and may indicate
309 an installation that would produce unpredictable results
310 -->
311 <!--
312 requires ant 1.7, and at this point, we're running 1.6 from
313 eclipse ... <condition property="expectedNumberOfLaunchers">
314 <resourcecount when="equal" count="1" > <fileset
315 dir="${testRoot}/eclipse/plugins"> <include
316 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
317 </resourcecount> </condition> <fail message="Did not find
318 expected number of launcher jars. Check installation."
319 unless="expectedNumberOfLaunchers" />
320 -->
david_williamsef62fc42011-03-18 02:33:39 +0000321
david_williamsba00a342011-03-12 05:11:19 +0000322 <condition
323 property="antQuietValue"
324 value="-quiet"
325 else="">
326 <istrue value="${env.USE_QUIET}"/>
327 </condition>
david_williams12def432010-08-09 04:42:21 +0000328 <java
329 taskname="unit-test-masterprocess"
330 fork="true"
331 resultProperty="wtpmasterjunitresult"
332 failonerror="false"
333 timeout="${testTimeLimit}"
334 dir="${testRoot}/eclipse"
335 jvm="${env.JAVA_6_HOME}/bin/java"
336 classname="org.eclipse.equinox.launcher.Main">
337 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000338 <fileset dir="${testRoot}/eclipse/plugins">
339 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams12def432010-08-09 04:42:21 +0000340 </fileset>
341 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000342 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
343 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
344 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
345 <jvmarg value="-Dws=${env.BASEWS}"/>
346 <jvmarg value="-Dos=${env.BASEOS}"/>
347 <jvmarg value="-Darch=${env.BASEARCH}"/>
348 <jvmarg value="-DbuildBranch=${buildBranch}"/>
349 <jvmarg value="-DbuildType=${buildType}"/>
350 <jvmarg value="-DdependencyFileLocation=${dependencyFileLocation}"/>
david_williams2398e362011-03-05 02:45:39 +0000351 <jvmarg value="-DbuildId=${buildId}"/>
352 <jvmarg value="-Dprojectname=${projectname}"/>
353 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williamsba00a342011-03-12 05:11:19 +0000354 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
355 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
david_williams2398e362011-03-05 02:45:39 +0000356 <jvmarg value="${testBundleParam}"/>
357 <arg value="-nosplash"/>
358 <arg value="-consolelog"/>
359 <arg value="-data"/>
360 <arg value="${testRoot}/overallTestWorkspace"/>
361 <arg value="-application"/>
362 <arg value="org.eclipse.ant.core.antRunner"/>
david_williamsba00a342011-03-12 05:11:19 +0000363 <arg value="${antQuietValue}"/>
david_williams2398e362011-03-05 02:45:39 +0000364 <arg value="-logger"/>
365 <arg value="org.apache.tools.ant.DefaultLogger"/>
366 <arg value="-file"/>
367 <arg value="${testRoot}/test.xml"/>
368 <arg value="${testTarget}"/>
david_williams12def432010-08-09 04:42:21 +0000369
370 <!-- make sure our forked env has a DISPLAY -->
371 <env
372 key="DISPLAY"
373 value="${env.DISPLAY}"/>
374 <redirector
375 output="${testRoot}/results/fullOutput.txt"
376 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2398e362011-03-05 02:45:39 +0000377 <jvmarg value="-Dbuild.home=${env.BUILD_HOME}"/>
378 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
379 <jvmarg value="-DbuildLabel=${buildLabel}"/>
380 <jvmarg value="-DbaseLocation=${baseLocation}"/>
381 <jvmarg value="-DtestRoot=${testRoot}"/>
382 <jvmarg value="-DtestDir=${testRoot}"/>
383 <jvmarg value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williams12def432010-08-09 04:42:21 +0000384 <!--
385 <!- - IBM_JAVA_OPTIONS contains JIT work arounds for bug
386 284441 - -> <env key="IBM_JAVA_OPTIONS"
387 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)"/>
388 -->
389 </java>
david_williams2398e362011-03-05 02:45:39 +0000390 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams12def432010-08-09 04:42:21 +0000391 </target>
david_williams2398e362011-03-05 02:45:39 +0000392 <target name="postRunTestEclipse">
david_williams12def432010-08-09 04:42:21 +0000393 <copy
394 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
395 overwrite="true"
396 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000397 <fileset dir="${testRoot}/results">
398 <include name="*output.txt"/>
david_williams12def432010-08-09 04:42:21 +0000399 </fileset>
400 </copy>
401 <copy
402 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
403 overwrite="true"
404 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000405 <fileset dir="${testRoot}/results">
406 <include name="*error.txt"/>
david_williams12def432010-08-09 04:42:21 +0000407 </fileset>
408 </copy>
409 <copy
410 file="${testRoot}/results/fullOutput.txt"
411 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
412 overwrite="true"
413 failonerror="false">
414 </copy>
415 <copy
416 file="${testRoot}/results/fullErrorLog.txt"
417 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
418 overwrite="true"
419 failonerror="false">
420 </copy>
421 <copy
422 todir="${buildDirectory}/${buildLabel}/testResults/xml"
423 overwrite="true"
424 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000425 <fileset dir="${testRoot}/results/xml">
426 <include name="*.xml"/>
david_williams12def432010-08-09 04:42:21 +0000427 </fileset>
428 </copy>
429 <copy
430 todir="${buildDirectory}/${buildLabel}/testResults/html"
431 overwrite="true"
432 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000433 <fileset dir="${testRoot}/results/html">
434 <include name="*.html"/>
david_williams12def432010-08-09 04:42:21 +0000435 </fileset>
436 </copy>
david_williams7e568c72010-09-12 09:04:15 +0000437 <copy
438 todir="${buildDirectory}/${buildLabel}/testResults/"
439 overwrite="true"
440 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000441 <fileset dir="${testRoot}/results/">
442 <include name="*.html"/>
david_williams7e568c72010-09-12 09:04:15 +0000443 </fileset>
444 </copy>
david_williams12def432010-08-09 04:42:21 +0000445 </target>
david_williamsba00a342011-03-12 05:11:19 +0000446
447 <target name="init">
448
449 <echo message="dropinsFolder: ${dropinsFolder} "/>
450 <condition
451 property="install.destination"
452 value="${testRoot}${dropinsFolder}/"
453 else="${testRoot}/eclipse">
454 <isset property="dropinsFolder"/>
455 </condition>
456
457 </target>
458
david_williams12def432010-08-09 04:42:21 +0000459</project>