blob: c053145cf10288b1b2d9d8c6c5c2c7caae5d8223 [file] [log] [blame]
david_williams403beae2007-12-09 02:10:40 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
ndaib8cedc82005-09-13 18:00:32 +00004
david_williams403beae2007-12-09 02:10:40 +00005 <!-- 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 -->
david_williamsad2097e2008-01-28 06:06:12 +00009 <property
10 environment="env" />
david_williams403beae2007-12-09 02:10:40 +000011 <fail
12 message="testRoot must be set for this task"
13 unless="testRoot" />
ndaib8cedc82005-09-13 18:00:32 +000014
david_williams403beae2007-12-09 02:10:40 +000015 <!-- ===================================================================== -->
16 <!-- Steps to do after the build is done. -->
17 <!-- ===================================================================== -->
david_williamsad2097e2008-01-28 06:06:12 +000018 <target
19 name="test">
david_williams403beae2007-12-09 02:10:40 +000020 <dirname
21 file="${ant.file}"
22 property="currentDirectory" />
23 <ant
24 antfile="${ant.file}"
25 target="runTest"
26 dir="${currentDirectory}" />
27 </target>
ndaib8cedc82005-09-13 18:00:32 +000028
david_williams403beae2007-12-09 02:10:40 +000029 <!-- ===================================================================== -->
30 <!-- Steps to do to test the build results -->
31 <!-- ===================================================================== -->
david_williamsad2097e2008-01-28 06:06:12 +000032 <target
33 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000034 <dirname
35 file="${ant.file}"
36 property="test.component.dir" />
david_williamsad2097e2008-01-28 06:06:12 +000037 <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" />
david_williams403beae2007-12-09 02:10:40 +000043 <fail
44 message="testRoot must be set for this task"
45 unless="testRoot" />
david_williamsad2097e2008-01-28 06:06:12 +000046 <mkdir
47 dir="${testRoot}" />
david_williamsf5f131a2007-03-17 06:12:13 +000048
david_williams403beae2007-12-09 02:10:40 +000049 <!-- if results already exist, delete them -->
50 <delete
51 dir="${testRoot}/results"
52 failOnError="false" />
david_williamsad2097e2008-01-28 06:06:12 +000053 <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" />
david_williams403beae2007-12-09 02:10:40 +000061 <copy
62 todir="${testRoot}"
63 overwrite="true">
david_williamsad2097e2008-01-28 06:06:12 +000064 <fileset
65 dir="${test.component.dir}/testScripts"></fileset>
david_williams403beae2007-12-09 02:10:40 +000066 </copy>
david_williams403beae2007-12-09 02:10:40 +000067 <echo
68 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
david_williams403beae2007-12-09 02:10:40 +000069 <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>
david_williamsad2097e2008-01-28 06:06:12 +000079 <antcall
80 target="unzipTests" />
81 <antcall
82 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000083 <param
84 name="testTarget"
85 value="all" />
86 </antcall>
david_williamsad2097e2008-01-28 06:06:12 +000087 <antcall
88 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000089 <param
90 name="testTarget"
91 value="all" />
92 </antcall>
david_williams403beae2007-12-09 02:10:40 +000093 </target>
david_williamsad2097e2008-01-28 06:06:12 +000094 <target
95 name="unzipTests">
david_williamsf5f131a2007-03-17 06:12:13 +000096
david_williams403beae2007-12-09 02:10:40 +000097 <!--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 <exec
102 dir="${buildDirectory}/${buildLabel}"
103 executable="unzip"
104 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000105 <arg
106 line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}" />
david_williams403beae2007-12-09 02:10:40 +0000107 </exec>
david_williams403beae2007-12-09 02:10:40 +0000108 <exec
109 dir="${buildDirectory}/${buildLabel}"
110 executable="unzip"
111 failonerror="false">
112 <arg
113 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
114 </exec>
115 <exec
116 dir="${buildDirectory}/${buildLabel}"
117 executable="unzip"
118 failonerror="false">
119 <arg
120 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
121 </exec>
david_williams403beae2007-12-09 02:10:40 +0000122 <exec
123 dir="${buildDirectory}/${buildLabel}"
124 executable="unzip"
125 failonerror="false">
126 <arg
127 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}" />
128 </exec>
129 <exec
130 dir="${buildDirectory}/${buildLabel}"
131 executable="unzip"
132 failonerror="false">
133 <arg
134 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
135 </exec>
david_williams403beae2007-12-09 02:10:40 +0000136 </target>
david_williamsf5f131a2007-03-17 06:12:13 +0000137
david_williams403beae2007-12-09 02:10:40 +0000138 <!-- time out may need to be set/adjust for api or performance tests?
139 This testTimeLimit is the whole, overall limit on tests. There's a shorter
140 one for individual suites.
141
142 some common values, of milliseconds to more recognizable units:
143 7200000: 2 hours
144 3600000: 1 hour
145 1800000: 30 minutes
146 600000: 10 minutes
147 -->
david_williams403beae2007-12-09 02:10:40 +0000148 <property
149 name="testTimeLimit"
150 value="7200000" />
151 <property
152 name="testFailOnError"
153 value="false" />
david_williams403beae2007-12-09 02:10:40 +0000154 <target
155 name="runTestEclipse"
156 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000157 <property
158 name="test-vm"
159 value="${env.JAVA_5_HOME}/bin/java" />
160 <property
161 name="plugin-path"
162 value="${testRoot}/eclipse/plugins" />
163 <property
164 name="vmargs"
165 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}" />
david_williams9d23a9d2007-03-16 02:23:53 +0000166
david_williams4b093692007-03-19 09:41:32 +0000167
david_williams403beae2007-12-09 02:10:40 +0000168 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
169 <property
170 name="eclipse.home"
171 value="${testRoot}" />
david_williamsad2097e2008-01-28 06:06:12 +0000172 <echo
173 message="Running junits" />
david_williams9d23a9d2007-03-16 02:23:53 +0000174
david_williams403beae2007-12-09 02:10:40 +0000175 <!-- If there is not exactly one launcher in the stack,
176 we'd best fail fast, since we are not expecting that,
177 and may indicate an installation that would produce unpredictable
178 results -->
179 <!-- requires ant 1.7, and at this point, we're running 1.6 from
180 eclipse ...
181
182 <condition property="expectedNumberOfLaunchers">
183 <resourcecount when="equal" count="1" >
184 <fileset dir="${testRoot}/eclipse/plugins">
185 <include name="org.eclipse.equinox.launcher_*.jar" />
186 </fileset>
187 </resourcecount>
188 </condition>
189 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
190 -->
191 <!--
192 Remember: using -debug for org.eclipse.ant.core.antRunner
193 produces ant debug info to be output ... which is a TON of stuff
194 -->
195 <java
196 taskname="unit-test-masterprocess"
197 fork="true"
198 resultProperty="wtpmasterjunitresult"
199 failonerror="false"
200 timeout="${testTimeLimit}"
201 dir="${testRoot}/eclipse"
202 jvm="${env.JAVA_5_HOME}/bin/java"
203 classname="org.eclipse.equinox.launcher.Main">
204 <classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000205 <fileset
206 dir="${testRoot}/eclipse/plugins">
207 <include
208 name="org.eclipse.equinox.launcher_*.jar" />
david_williams403beae2007-12-09 02:10:40 +0000209 </fileset>
210 </classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000211 <jvmarg
212 value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol" />
213 <jvmarg
214 value="-DurlLogLocation=${buildDirectory}/fromtestsoutgoinghttp.log" />
215 <jvmarg
216 value="-Xms512m" />
217 <jvmarg
218 value="-Xmx1024m" />
219 <jvmarg
220 value="-Dosgi.ws=${env.BASEWS}" />
221 <jvmarg
222 value="-Dosgi.os=${env.BASEOS}" />
223 <jvmarg
224 value="-Dosgi.arch=${env.BASEARCH}" />
225 <jvmarg
226 value="-Dws=${env.BASEWS}" />
227 <jvmarg
228 value="-Dos=${env.BASEOS}" />
229 <jvmarg
230 value="-Darch=${env.BASEARCH}" />
231 <jvmarg
232 value="-Dosgi.clean=true" />
233 <jvmarg
234 value="-Dnoclean=true" />
235 <jvmarg
236 value="-DbuildBranch=${buildBranch}" />
237 <jvmarg
238 value="-DbuildType=${buildType}" />
239 <jvmarg
240 value="-DbuildId=${buildId}" />
241 <arg
242 value="-nosplash" />
243 <arg
244 value="-consolelog" />
245 <arg
246 value="-data" />
247 <arg
248 value="${testRoot}/overallTestWorkspace" />
249 <arg
250 value="-application" />
251 <arg
252 value="org.eclipse.ant.core.antRunner" />
253 <arg
254 value="-file" />
255 <arg
256 value="${testRoot}/test.xml" />
257 <arg
258 value="-logger" />
259 <arg
260 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000261 <env
262 key="DISPLAY"
263 value="${env.DISPLAY}" />
264 <redirector
265 output="${testRoot}/results/fullOutput.txt"
266 error="${testRoot}/results/fullErrorLog.txt" />
267 <sysproperty
268 key="build.home"
269 value="${env.BUILD_HOME}" />
270 <sysproperty
271 key="buildDirectory"
272 value="${buildDirectory}" />
273 <sysproperty
274 key="buildLabel"
275 value="${buildLabel}" />
276 <sysproperty
277 key="baseLocation"
278 value="${baseLocation}" />
279 <sysproperty
280 key="testRoot"
281 value="${testRoot}" />
282 <sysproperty
283 key="testDir"
284 value="${testRoot}" />
285 <sysproperty
286 key="perf.buildId"
287 value="${buildType}${date}-${time}" />
288 <sysproperty
289 key="eclipseBuilderDirectory"
290 value="${pde.builder.path}" />
291 <sysproperty
292 key="buildLabel"
293 value="${buildLabel}" />
294 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000295 <echo
296 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000297 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000298 <target
299 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000300 <copy
301 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
302 overwrite="true"
303 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000304 <fileset
305 dir="${testRoot}/results">
306 <include
307 name="*output.txt" />
david_williams403beae2007-12-09 02:10:40 +0000308 </fileset>
309 </copy>
310 <copy
311 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
312 overwrite="true"
313 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000314 <fileset
315 dir="${testRoot}/results">
316 <include
317 name="*error.txt" />
david_williams403beae2007-12-09 02:10:40 +0000318 </fileset>
319 </copy>
320 <copy
321 file="${testRoot}/results/fullOutput.txt"
322 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
323 overwrite="true"
324 failonerror="false">
325 </copy>
326 <copy
327 file="${testRoot}/results/fullErrorLog.txt"
328 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
329 overwrite="true"
330 failonerror="false">
331 </copy>
david_williams403beae2007-12-09 02:10:40 +0000332 <copy
333 todir="${buildDirectory}/${buildLabel}/testResults/xml"
334 overwrite="true"
335 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000336 <fileset
337 dir="${testRoot}/results/xml">
338 <include
339 name="*.xml" />
david_williams403beae2007-12-09 02:10:40 +0000340 </fileset>
341 </copy>
342 <copy
343 todir="${buildDirectory}/${buildLabel}/testResults/html"
344 overwrite="true"
345 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000346 <fileset
347 dir="${testRoot}/results/html">
348 <include
349 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000350 </fileset>
351 </copy>
352 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000353</project>