blob: 4e5843a2e58ef403e341e93c73e78e9e16f11dd9 [file] [log] [blame]
david_williams8a0244f2010-04-16 05:48:42 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
david_williamsb676cc52011-04-05 01:50:04 +00004 <!-- Note to be cross-platform, "environment variables" are only appropriate
5 for some variables, e.g. ones we set, since properties are case sensitive,
6 even if the environment variables on your operating system are not, e.g.
7 it will be ${env.Path} not ${env.PATH} on Windows -->
david_williams2398e362011-03-05 02:45:39 +00008 <property environment="env"/>
david_williams8a0244f2010-04-16 05:48:42 +00009 <fail
10 message="testRoot must be set for this task"
11 unless="testRoot"/>
david_williamsb676cc52011-04-05 01:50:04 +000012 <!-- required to get proper value of dropinsFolder -->
david_williams8a0244f2010-04-16 05:48:42 +000013 <property
14 name="keyCfgFile"
15 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
16 <echo
17 level="info"
18 message="keyCfgFile: ${keyCfgFile}"/>
david_williams2398e362011-03-05 02:45:39 +000019 <property file="${keyCfgFile}"/>
david_williamsb676cc52011-04-05 01:50:04 +000020 <!-- typcially already set, but in case of standalone tests, may not be -->
david_williams8a0244f2010-04-16 05:48:42 +000021 <property
22 name="buildLabel"
23 value="${buildType}-${buildId}-${timestamp}"/>
24
25
david_williamsb676cc52011-04-05 01:50:04 +000026 <!-- Steps to do after the build is done. -->
david_williams2398e362011-03-05 02:45:39 +000027 <target name="test">
david_williams8a0244f2010-04-16 05:48:42 +000028 <dirname
29 file="${ant.file}"
30 property="currentDirectory"/>
31 <ant
32 antfile="${ant.file}"
33 target="runTest"
34 dir="${currentDirectory}"/>
35 </target>
36
david_williamsb676cc52011-04-05 01:50:04 +000037 <!-- Steps to do to test the build results -->
david_williams2398e362011-03-05 02:45:39 +000038 <target name="runTest">
david_williams8a0244f2010-04-16 05:48:42 +000039 <dirname
40 file="${ant.file}"
41 property="test.component.dir"/>
david_williams2398e362011-03-05 02:45:39 +000042 <ant antfile="${wtp.builder.home}/scripts/build/label.xml"/>
43 <property file="${buildDirectory}/label.properties"/>
44 <property file="${wtp.builder.home}/build.properties"/>
david_williams8a0244f2010-04-16 05:48:42 +000045 <fail
46 message="testRoot must be set for this task"
47 unless="testRoot"/>
david_williams2398e362011-03-05 02:45:39 +000048 <mkdir dir="${testRoot}"/>
david_williams8a0244f2010-04-16 05:48:42 +000049
david_williamsb676cc52011-04-05 01:50:04 +000050 <!-- if results already exist, delete them -->
david_williams8a0244f2010-04-16 05:48:42 +000051 <delete
52 dir="${testRoot}/results"
53 failOnError="false"/>
david_williams2398e362011-03-05 02:45:39 +000054 <mkdir dir="${testRoot}/results"/>
55 <mkdir dir="${testRoot}/results/consolelogs"/>
david_williams8a0244f2010-04-16 05:48:42 +000056 <copy
57 todir="${testRoot}"
58 overwrite="true">
david_williams2398e362011-03-05 02:45:39 +000059 <fileset dir="${test.component.dir}/testScripts"/>
david_williams8a0244f2010-04-16 05:48:42 +000060 </copy>
david_williams2398e362011-03-05 02:45:39 +000061 <echo message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williamsf46c7712010-08-08 01:58:59 +000062
david_williams8a0244f2010-04-16 05:48:42 +000063 <property
64 name="dependency.properties"
david_williamsf46c7712010-08-08 01:58:59 +000065 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
david_williams8a0244f2010-04-16 05:48:42 +000066 <available
67 file="${dependency.properties}"
68 property="dependency.properties.exists"/>
69 <fail
70 message="dependency file not found: ${dependency.properties}"
71 unless="dependency.properties.exists"/>
david_williamsb676cc52011-04-05 01:50:04 +000072 <property
73 name="test.dependency"
74 value="${wtp.builder.home}/scripts/dependency/dependency.xml"/>
75 <available
76 file="${test.dependency}"
77 property="test.dependency.exists"/>
78 <fail
79 message="test dependency file not found: ${test.dependency}"
80 unless="test.dependency.exists"/>
81 <echo message="test.dependency file: ${test.dependency}"/>
david_williams8a0244f2010-04-16 05:48:42 +000082 <ant
david_williamsb676cc52011-04-05 01:50:04 +000083 antfile="${test.dependency}"
david_williams8a0244f2010-04-16 05:48:42 +000084 target="get">
85 <property
86 name="base.install.dir"
87 value="${testRoot}"/>
david_williamsb676cc52011-04-05 01:50:04 +000088 <property
89 name="tobeinstalled.properties"
david_williamsc7d9f682011-06-20 21:23:02 +000090 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/distribution/${build.distribution}.tests/tobeInstalled.properties"/>
david_williamsb676cc52011-04-05 01:50:04 +000091 <property
92 name="installWorkingDirectory"
93 value="${testRoot}"/>
david_williams8a0244f2010-04-16 05:48:42 +000094 </ant>
david_williamsb676cc52011-04-05 01:50:04 +000095 <echo message="Done setting up WTP"/>
96
97 <!--We use the eclipse performance framework to run and install tests.
98 This is no longer needed but it should stay just in case it is needed later.
99 <antcall target="installTests"/> <antcall target="runTestEclipse"> <param
100 name="testTarget" value="all"/> </antcall> <antcall target="postRunTestEclipse">
101 <param name="testTarget" value="all"/> </antcall> -->
david_williams8a0244f2010-04-16 05:48:42 +0000102 </target>
david_williamsb676cc52011-04-05 01:50:04 +0000103 <target name="installTests">
104
105 <!-- hard code for now <antcall target="installTestsFromZips"> <param name="compName"
106 value="patches32x"/> </antcall> -->
107 <antcall target="installTestsFromRepo">
108 </antcall>
109
110
david_williams8a0244f2010-04-16 05:48:42 +0000111 </target>
david_williamsb676cc52011-04-05 01:50:04 +0000112 <target
113 name="installTestsFromZips"
114 depends="init">
115
116 <!-- a bit hard coded here, will need work for general case -->
117 <property
118 name="zipFile"
119 value="${compName}-${buildLabel}.zip"/>
120
121
122 <!-- We use the exec method for unzip, so we won't fail if a prereq can
123 not be unzipped for some reason. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=283968 -->
124 <mkdir dir="${install.destination}"/>
125 <exec
126 dir="."
127 executable="unzip">
128 <arg line="-o -qq ${buildDirectory}/${buildLabel}/${zipFile} -d ${install.destination}/${compName}"/>
129 </exec>
130
131 </target>
132
133 <target name="installTestsFromRepo">
134
135 <java
136 taskname="p2Director Install"
137 fork="true"
138 resultProperty="p2DirectorInstallResult"
139 failonerror="false"
140 timeout="${testTimeLimit}"
141 dir="${testRoot}"
142 jvm="${env.JAVA_6_HOME}/bin/java"
143 classname="org.eclipse.equinox.launcher.Main">
144 <classpath>
145 <fileset dir="${testRoot}/eclipse/plugins">
146 <include name="org.eclipse.equinox.launcher_*.jar"/>
147 </fileset>
148 </classpath>
149 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
150 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
151 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
152 <arg value="-nosplash"/>
153 <arg value="-debug"/>
154 <arg value="-consolelog"/>
155 <arg value="-data"/>
156 <arg value="${testRoot}/p2DirectorInstall"/>
157 <arg value="-application"/>
158 <arg value="org.eclipse.equinox.p2.director"/>
159 <arg value="-destination"/>
160 <arg value="${testRoot}/eclipse"/>
161
162 <arg value="-repository"/>
163 <arg value="file://${buildDirectory}/${buildLabel}/repository/,file://${buildDirectory}/${buildLabel}/repositoryunittests/"/>
164 <arg value="-installIU"/>
165 <arg value="${wtpFeatureIUs},${testFeatureIUs}"/>
166
167 <!-- make sure our forked env has a DISPLAY -->
168 <env
169 key="DISPLAY"
170 value="${env.DISPLAY}"/>
171 <redirector
172 output="${testRoot}/results/fullOutput.txt"
173 error="${testRoot}/results/fullErrorLog.txt"/>
174
175 </java>
176 <!-- If the task succeeds, this ouput log won't be that relevent ... (can
177 be make better in future ... but for now we'll make a copy, just in case
178 we need it -->
179 <echo message="p2DirectorInstallResult: ${p2DirectorInstallResult}"/>
180
181 <condition property="p2DirectorInstallFailed">
182 <not>
183 <equals
184 arg1="0"
185 arg2="${p2DirectorInstallResult}"/>
186 </not>
187 </condition>
188
189 <!-- always copy to test results, even when successful -->
190 <copy
191 file="${testRoot}/results/fullOutput.txt"
192 tofile="${buildDirectory}/${buildLabel}/testResults/p2DirectorInstall.log.txt"
193 overwrite="false"
194 failonerror="false">
195 </copy>
196
197 <antcall target="handleFailedInstall"/>
198
199
200 </target>
201 <target
202 name="handleFailedInstall"
203 if="p2DirectorInstallFailed">
204
205 <!-- copy to direct location, as a signal (to web pages) it failed and
206 link should be provided -->
207 <copy
208 file="${testRoot}/results/fullOutput.txt"
209 tofile="${buildDirectory}/${buildLabel}/p2DirectorInstall.log.txt"
210 overwrite="false"
211 failonerror="false">
212 </copy>
213
214 <fail
215 message="installation of tests failed. See p2DirectorInstall.log.txt."
216 if="p2DirectorInstallResult"/>
217
218 </target>
219 <!-- time out may need to be set/adjust for api or performance tests? This
220 testTimeLimit is the whole, overall limit on tests. There's a shorter one
221 for individual suites. some common values, of milliseconds to more recognizable
222 units: 18000000: 5 hours 14400000: 4 hours 7200000: 2 hours 3600000: 1 hour
223 1800000: 30 minutes 600000: 10 minutes -->
david_williams8a0244f2010-04-16 05:48:42 +0000224 <property
225 name="testTimeLimit"
david_williamsb676cc52011-04-05 01:50:04 +0000226 value="28800000"/>
david_williams8a0244f2010-04-16 05:48:42 +0000227 <property
228 name="testFailOnError"
229 value="false"/>
230 <target
231 name="runTestEclipse"
232 description="Run our JUnit's within an instance of antRunner">
233 <property
234 name="test-vm"
235 value="${env.JAVA_6_HOME}/bin/java"/>
david_williamsb676cc52011-04-05 01:50:04 +0000236 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use
237 c:\path\to\eclipse or /path/to/eclipse/ -->
david_williams8a0244f2010-04-16 05:48:42 +0000238 <property
239 name="eclipse.home"
240 value="${testRoot}"/>
david_williams2398e362011-03-05 02:45:39 +0000241 <echo message="testTarget: ${testTarget}"/>
david_williamsb676cc52011-04-05 01:50:04 +0000242 <!-- can not pass in empty values in jvmargs so if not testBundle specified,
243 we'll pass a junk (unused) value -->
david_williams8a0244f2010-04-16 05:48:42 +0000244 <condition
245 property="testBundleParam"
246 value="-DtestBundle=${testBundle}"
247 else="-Dunused=nouse">
david_williams2398e362011-03-05 02:45:39 +0000248 <isset property="testBundle"/>
david_williams8a0244f2010-04-16 05:48:42 +0000249 </condition>
david_williams2398e362011-03-05 02:45:39 +0000250 <echo message="Running junits"/>
david_williamsb676cc52011-04-05 01:50:04 +0000251 <!-- If there is not exactly one launcher in the stack, we'd best fail
252 fast, since we are not expecting that, and may indicate an installation that
253 would produce unpredictable results -->
254 <!-- requires ant 1.7, and at this point, we're running 1.6 from eclipse
255 ... <condition property="expectedNumberOfLaunchers"> <resourcecount when="equal"
256 count="1" > <fileset dir="${testRoot}/eclipse/plugins"> <include name="org.eclipse.equinox.launcher_*.jar"
257 /> </fileset> </resourcecount> </condition> <fail message="Did not find expected
258 number of launcher jars. Check installation." unless="expectedNumberOfLaunchers"
259 /> -->
260 <!-- Remember: using dash 'debug' for org.eclipse.ant.core.antRunner produces
261 ant debug info to be output ... which is a TON of stuff. Even 'verbose' is
262 a bit too much. -->
263 <echo message="eclipse.launcher: ${eclipse.launcher}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000264 <java
265 taskname="unit-test-masterprocess"
266 fork="true"
267 resultProperty="wtpmasterjunitresult"
268 failonerror="false"
269 timeout="${testTimeLimit}"
270 dir="${testRoot}/eclipse"
271 jvm="${env.JAVA_6_HOME}/bin/java"
272 classname="org.eclipse.equinox.launcher.Main">
273 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000274 <fileset dir="${testRoot}/eclipse/plugins">
275 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams8a0244f2010-04-16 05:48:42 +0000276 </fileset>
277 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000278 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
279 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
280 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
281 <jvmarg value="-Dws=${env.BASEWS}"/>
282 <jvmarg value="-Dos=${env.BASEOS}"/>
283 <jvmarg value="-Darch=${env.BASEARCH}"/>
284 <jvmarg value="-DbuildBranch=${buildBranch}"/>
285 <jvmarg value="-DbuildType=${buildType}"/>
286 <jvmarg value="-DdependencyFileLocation=${dependencyFileLocation}"/>
david_williams2398e362011-03-05 02:45:39 +0000287 <jvmarg value="-DbuildId=${buildId}"/>
288 <jvmarg value="-Dprojectname=${projectname}"/>
289 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
290 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
291 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
292 <jvmarg value="-Dorg.eclipse.jst.server.tomcat.50=${testRoot}/jakarta-tomcat-5.0.28"/>
293 <jvmarg value="${testBundleParam}"/>
294 <arg value="-nosplash"/>
295 <arg value="-consolelog"/>
296 <arg value="-data"/>
297 <arg value="${testRoot}/overallTestWorkspace"/>
298 <arg value="-application"/>
299 <arg value="org.eclipse.ant.core.antRunner"/>
300 <arg value="-logger"/>
301 <arg value="org.apache.tools.ant.DefaultLogger"/>
302 <arg value="-file"/>
303 <arg value="${testRoot}/perftest.xml"/>
304 <arg value="${testTarget}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000305
david_williamsb676cc52011-04-05 01:50:04 +0000306 <!-- make sure our forked env has a DISPLAY -->
david_williams8a0244f2010-04-16 05:48:42 +0000307 <env
308 key="DISPLAY"
309 value="${env.DISPLAY}"/>
310 <redirector
311 output="${testRoot}/results/fullOutput.txt"
312 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2398e362011-03-05 02:45:39 +0000313 <jvmarg value="-Dbuild.home=${env.BUILD_HOME}"/>
314 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
315 <jvmarg value="-DbuildLabel=${buildLabel}"/>
316 <jvmarg value="-DbaseLocation=${baseLocation}"/>
317 <jvmarg value="-DtestRoot=${testRoot}"/>
318 <jvmarg value="-DtestDir=${testRoot}"/>
319 <jvmarg value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williamsb676cc52011-04-05 01:50:04 +0000320 <!-- IBM_JAVA_OPTIONS contains JIT work arounds for bug 284441 <env key="IBM_JAVA_OPTIONS"
321 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)"/> -->
david_williams8a0244f2010-04-16 05:48:42 +0000322 </java>
david_williams2398e362011-03-05 02:45:39 +0000323 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000324 </target>
david_williams2398e362011-03-05 02:45:39 +0000325 <target name="postRunTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +0000326 <copy
327 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
328 overwrite="true"
329 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000330 <fileset dir="${testRoot}/results">
331 <include name="*output.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000332 </fileset>
333 </copy>
334 <copy
335 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
336 overwrite="true"
337 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000338 <fileset dir="${testRoot}/results">
339 <include name="*error.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000340 </fileset>
341 </copy>
342 <copy
343 file="${testRoot}/results/fullOutput.txt"
344 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
345 overwrite="true"
346 failonerror="false">
347 </copy>
348 <copy
349 file="${testRoot}/results/fullErrorLog.txt"
350 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
351 overwrite="true"
352 failonerror="false">
353 </copy>
354 <copy
355 todir="${buildDirectory}/${buildLabel}/testResults/xml"
356 overwrite="true"
357 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000358 <fileset dir="${testRoot}/results/xml">
359 <include name="*.xml"/>
david_williams8a0244f2010-04-16 05:48:42 +0000360 </fileset>
361 </copy>
362 <copy
363 todir="${buildDirectory}/${buildLabel}/testResults/html"
364 overwrite="true"
365 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000366 <fileset dir="${testRoot}/results/html">
367 <include name="*.html"/>
david_williams8a0244f2010-04-16 05:48:42 +0000368 </fileset>
369 </copy>
david_williamsb676cc52011-04-05 01:50:04 +0000370 <copy
371 todir="${buildDirectory}/${buildLabel}/testResults/"
372 overwrite="true"
373 failonerror="false">
374 <fileset dir="${testRoot}/results/">
375 <include name="*.html"/>
376 </fileset>
377 </copy>
david_williams8a0244f2010-04-16 05:48:42 +0000378 </target>
david_williamsb676cc52011-04-05 01:50:04 +0000379
380 <target name="init">
381
382 <echo message="dropinsFolder: ${dropinsFolder} "/>
383 <condition
384 property="install.destination"
385 value="${testRoot}${dropinsFolder}/"
386 else="${testRoot}/eclipse">
387 <isset property="dropinsFolder"/>
388 </condition>
389
390 </target>
391
david_williams8a0244f2010-04-16 05:48:42 +0000392</project>