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