blob: 4212b711546daf0adc77c5aec57de19673b20de7 [file] [log] [blame]
david_williams8a0244f2010-04-16 05:48:42 +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 -->
11 <property
12 environment="env"/>
13 <fail
14 message="testRoot must be set for this task"
15 unless="testRoot"/>
16 <!-- required to get proper value of dropinsFolder -->
17 <property
18 name="keyCfgFile"
19 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
20 <echo
21 level="info"
22 message="keyCfgFile: ${keyCfgFile}"/>
23 <property
24 file="${keyCfgFile}"/>
25 <!--
26 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 <!--
35 Steps to do after the build is done.
36 -->
37 <target
38 name="test">
39 <dirname
40 file="${ant.file}"
41 property="currentDirectory"/>
42 <ant
43 antfile="${ant.file}"
44 target="runTest"
45 dir="${currentDirectory}"/>
46 </target>
47
48 <!--
49 Steps to do to test the build results
50 -->
51 <target
52 name="runTest">
53 <dirname
54 file="${ant.file}"
55 property="test.component.dir"/>
56 <ant
57 antfile="${wtp.builder.home}/scripts/build/label.xml"/>
58 <property
59 file="${buildDirectory}/label.properties"/>
60 <property
61 file="${wtp.builder.home}/build.properties"/>
62 <fail
63 message="testRoot must be set for this task"
64 unless="testRoot"/>
65 <mkdir
66 dir="${testRoot}"/>
67
68 <!-- if results already exist, delete them -->
69 <delete
70 dir="${testRoot}/results"
71 failOnError="false"/>
72 <mkdir
73 dir="${testRoot}/results"/>
74 <mkdir
75 dir="${testRoot}/results/consolelogs"/>
76 <copy
77 todir="${testRoot}"
78 overwrite="true">
79 <fileset
80 dir="${test.component.dir}/testScripts"/>
81 </copy>
82 <echo
83 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
84 <!--
85 for this distribution, dependencies come from releng. Assume
86 no subdirectory, if not otherwise set (bug 285383).
87 -->
88 <property
89 name="env.DEP_DIR"
90 value=""/>
91 <property
92 name="dependency.properties"
93 value="${buildDirectory}/maps/${env.RELENG}${env.DEP_DIR}/maps/dependencies.properties"/>
94 <available
95 file="${dependency.properties}"
96 property="dependency.properties.exists"/>
97 <fail
98 message="dependency file not found: ${dependency.properties}"
99 unless="dependency.properties.exists"/>
100 <ant
101 antfile="${test.component.dir}/testdependency.xml"
102 target="get">
103 <property
104 name="base.install.dir"
105 value="${testRoot}"/>
106 </ant>
107 <antcall
108 target="unzipTests"/>
109 <antcall
110 target="runTestEclipse">
111 <param
112 name="testTarget"
113 value="all"/>
114 </antcall>
115 <antcall
116 target="postRunTestEclipse">
117 <param
118 name="testTarget"
119 value="all"/>
120 </antcall>
121 </target>
122 <target
123 name="unzipTests">
124 <!--
125 unzip the builds and junit tests we use 'unzip' here, so we
126 can continue on error, if desired. (such as if zip was not
127 created, due to other failures or options).
128 -->
129 <exec
130 dir="${buildDirectory}/${buildLabel}"
131 executable="unzip"
132 failonerror="true">
133 <arg
134 line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
135 </exec>
136 <exec
137 dir="${buildDirectory}/${buildLabel}"
138 executable="unzip"
139 failonerror="false">
140 <arg
141 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
142 </exec>
143 <exec
144 dir="${buildDirectory}/${buildLabel}"
145 executable="unzip"
146 failonerror="false">
147 <arg
148 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
149 </exec>
150 <exec
151 dir="${buildDirectory}/${buildLabel}"
152 executable="unzip"
153 failonerror="false">
154 <arg
155 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
156 </exec>
157 <exec
158 dir="${buildDirectory}/${buildLabel}"
159 executable="unzip"
160 failonerror="true">
161 <arg
162 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
163 </exec>
164 </target>
165 <!--
166 time out may need to be set/adjust for api or performance tests?
167 This testTimeLimit is the whole, overall limit on tests. There's
168 a shorter one for individual suites. some common values, of
169 milliseconds to more recognizable units:
170 18000000: 5 hours
171 14400000: 4 hours
172 7200000: 2 hours
173 3600000: 1 hour
174 1800000: 30 minutes
175 600000: 10 minutes
176 -->
177 <property
178 name="testTimeLimit"
179 value="36000000"/>
180 <property
181 name="testFailOnError"
182 value="false"/>
183 <target
184 name="runTestEclipse"
185 description="Run our JUnit's within an instance of antRunner">
186 <property
187 name="test-vm"
188 value="${env.JAVA_6_HOME}/bin/java"/>
189 <!--
190 set path to eclipse folder. If local folder, use '.';
191 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
192 -->
193 <property
194 name="eclipse.home"
195 value="${testRoot}"/>
196 <echo
197 message="testTarget: ${testTarget}"/>
198 <!--
199 can not pass in empty values in jvmargs so if not testBundle
200 specified, we'll pass a junk (unused) value
201 -->
202 <condition
203 property="testBundleParam"
204 value="-DtestBundle=${testBundle}"
205 else="-Dunused=nouse">
206 <isset
207 property="testBundle"/>
208 </condition>
209 <echo
210 message="Running junits"/>
211 <!--
212 If there is not exactly one launcher in the stack, we'd best
213 fail fast, since we are not expecting that, and may indicate
214 an installation that would produce unpredictable results
215 -->
216 <!--
217 requires ant 1.7, and at this point, we're running 1.6 from
218 eclipse ... <condition property="expectedNumberOfLaunchers">
219 <resourcecount when="equal" count="1" > <fileset
220 dir="${testRoot}/eclipse/plugins"> <include
221 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
222 </resourcecount> </condition> <fail message="Did not find
223 expected number of launcher jars. Check installation."
224 unless="expectedNumberOfLaunchers" />
225 -->
226 <!--
227 Remember: using dash 'debug' for org.eclipse.ant.core.antRunner
228 produces ant debug info to be output ... which is a TON of
229 stuff. Even 'verbose' is a bit too much.
230 -->
231 <echo
232 message="eclipse.launcher: ${eclipse.launcher}"/>
233 <java
234 taskname="unit-test-masterprocess"
235 fork="true"
236 resultProperty="wtpmasterjunitresult"
237 failonerror="false"
238 timeout="${testTimeLimit}"
239 dir="${testRoot}/eclipse"
240 jvm="${env.JAVA_6_HOME}/bin/java"
241 classname="org.eclipse.equinox.launcher.Main">
242 <classpath>
243 <fileset
244 dir="${testRoot}/eclipse/plugins">
245 <include
246 name="org.eclipse.equinox.launcher_*.jar"/>
247 </fileset>
248 </classpath>
249 <jvmarg
250 value="-Dosgi.ws=${env.BASEWS}"/>
251 <jvmarg
252 value="-Dosgi.os=${env.BASEOS}"/>
253 <jvmarg
254 value="-Dosgi.arch=${env.BASEARCH}"/>
255 <jvmarg
256 value="-Dws=${env.BASEWS}"/>
257 <jvmarg
258 value="-Dos=${env.BASEOS}"/>
259 <jvmarg
260 value="-Darch=${env.BASEARCH}"/>
261 <jvmarg
262 value="-DbuildBranch=${buildBranch}"/>
263 <jvmarg
264 value="-DbuildType=${buildType}"/>
265 <jvmarg
266 value="-DbuildId=${buildId}"/>
267 <jvmarg
268 value="-Dprojectname=${projectname}"/>
269 <jvmarg
270 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
271 <jvmarg
272 value="-Dorg.eclipse.jst.server.tomcat.50=${testRoot}/jakarta-tomcat-5.0.28"/>
273 <jvmarg
274 value="${testBundleParam}"/>
275 <arg
276 value="-nosplash"/>
277 <arg
278 value="-consolelog"/>
279 <arg
280 value="-data"/>
281 <arg
282 value="${testRoot}/overallTestWorkspace"/>
283 <arg
284 value="-application"/>
285 <arg
286 value="org.eclipse.ant.core.antRunner"/>
287 <arg
288 value="-logger"/>
289 <arg
290 value="org.apache.tools.ant.DefaultLogger"/>
291 <arg
292 value="-file"/>
293 <arg
294 value="${testRoot}/perftest.xml"/>
295 <arg
296 value="${testTarget}"/>
297
298 <!-- make sure our forked env has a DISPLAY -->
299 <env
300 key="DISPLAY"
301 value="${env.DISPLAY}"/>
302 <redirector
303 output="${testRoot}/results/fullOutput.txt"
304 error="${testRoot}/results/fullErrorLog.txt"/>
305 <jvmarg
306 value="-Dbuild.home=${env.BUILD_HOME}"/>
307 <jvmarg
308 value="-DbuildDirectory=${buildDirectory}"/>
309 <jvmarg
310 value="-DbuildLabel=${buildLabel}"/>
311 <jvmarg
312 value="-DbaseLocation=${baseLocation}"/>
313 <jvmarg
314 value="-DtestRoot=${testRoot}"/>
315 <jvmarg
316 value="-DtestDir=${testRoot}"/>
317 <jvmarg
318 value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
319 <!-- IBM_JAVA_OPTIONS contains JIT work arounds for bug 284441 -->
320 <env
321 key="IBM_JAVA_OPTIONS"
322 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)"/>
323 </java>
324 <echo
325 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
326 </target>
327 <target
328 name="postRunTestEclipse">
329 <copy
330 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
331 overwrite="true"
332 failonerror="false">
333 <fileset
334 dir="${testRoot}/results">
335 <include
336 name="*output.txt"/>
337 </fileset>
338 </copy>
339 <copy
340 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
341 overwrite="true"
342 failonerror="false">
343 <fileset
344 dir="${testRoot}/results">
345 <include
346 name="*error.txt"/>
347 </fileset>
348 </copy>
349 <copy
350 file="${testRoot}/results/fullOutput.txt"
351 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
352 overwrite="true"
353 failonerror="false">
354 </copy>
355 <copy
356 file="${testRoot}/results/fullErrorLog.txt"
357 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
358 overwrite="true"
359 failonerror="false">
360 </copy>
361 <copy
362 todir="${buildDirectory}/${buildLabel}/testResults/xml"
363 overwrite="true"
364 failonerror="false">
365 <fileset
366 dir="${testRoot}/results/xml">
367 <include
368 name="*.xml"/>
369 </fileset>
370 </copy>
371 <copy
372 todir="${buildDirectory}/${buildLabel}/testResults/html"
373 overwrite="true"
374 failonerror="false">
375 <fileset
376 dir="${testRoot}/results/html">
377 <include
378 name="*.html"/>
379 </fileset>
380 </copy>
381 </target>
382</project>