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