blob: bdd49c0b4fd29a243eb7fe7b699d38a12c6148ae [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_williamscfd9a4a2008-03-27 16:35:01 +000011 <!-- required to get proper value of dropinsFolder -->
12 <property name="keyCfgFile" value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg" />
13 <echo message="keyCfgFile: ${keyCfgFile}" />
14 <property file="${keyCfgFile}" />
david_williams403beae2007-12-09 02:10:40 +000015 <fail
16 message="testRoot must be set for this task"
17 unless="testRoot" />
ndaib8cedc82005-09-13 18:00:32 +000018
david_williams43089362008-03-25 05:43:38 +000019 <!--
20 Steps to do after the build is done.
21 -->
david_williamsad2097e2008-01-28 06:06:12 +000022 <target
23 name="test">
david_williams403beae2007-12-09 02:10:40 +000024 <dirname
25 file="${ant.file}"
26 property="currentDirectory" />
27 <ant
28 antfile="${ant.file}"
29 target="runTest"
30 dir="${currentDirectory}" />
31 </target>
ndaib8cedc82005-09-13 18:00:32 +000032
david_williams43089362008-03-25 05:43:38 +000033 <!--
34 Steps to do to test the build results
35 -->
david_williamsad2097e2008-01-28 06:06:12 +000036 <target
37 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000038 <dirname
39 file="${ant.file}"
40 property="test.component.dir" />
david_williamsad2097e2008-01-28 06:06:12 +000041 <ant
42 antfile="${wtp.builder.home}/scripts/build/label.xml" />
43 <property
44 file="${buildDirectory}/label.properties" />
45 <property
46 file="${wtp.builder.home}/build.properties" />
david_williams403beae2007-12-09 02:10:40 +000047 <fail
48 message="testRoot must be set for this task"
49 unless="testRoot" />
david_williamsad2097e2008-01-28 06:06:12 +000050 <mkdir
51 dir="${testRoot}" />
david_williamsf5f131a2007-03-17 06:12:13 +000052
david_williams403beae2007-12-09 02:10:40 +000053 <!-- if results already exist, delete them -->
54 <delete
55 dir="${testRoot}/results"
56 failOnError="false" />
david_williamsad2097e2008-01-28 06:06:12 +000057 <mkdir
58 dir="${testRoot}/results" />
59 <mkdir
60 dir="${testRoot}/results/consolelogs" />
61 <mkdir
62 dir="${testRoot}/results/consolelogs/metadata-logs" />
63 <mkdir
64 dir="${testRoot}/results/consolelogs/configuration-logs" />
david_williams403beae2007-12-09 02:10:40 +000065 <copy
66 todir="${testRoot}"
67 overwrite="true">
david_williamsad2097e2008-01-28 06:06:12 +000068 <fileset
david_williams43089362008-03-25 05:43:38 +000069 dir="${test.component.dir}/testScripts" />
david_williams403beae2007-12-09 02:10:40 +000070 </copy>
david_williams403beae2007-12-09 02:10:40 +000071 <echo
72 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
david_williams403beae2007-12-09 02:10:40 +000073 <ant
74 antfile="${test.component.dir}/testdependency.xml"
75 target="get">
76 <property
77 name="dependency.properties"
78 value="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties" />
79 <property
80 name="base.install.dir"
81 value="${testRoot}" />
82 </ant>
david_williamsad2097e2008-01-28 06:06:12 +000083 <antcall
84 target="unzipTests" />
85 <antcall
86 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000087 <param
88 name="testTarget"
89 value="all" />
90 </antcall>
david_williamsad2097e2008-01-28 06:06:12 +000091 <antcall
92 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000093 <param
94 name="testTarget"
95 value="all" />
96 </antcall>
david_williams403beae2007-12-09 02:10:40 +000097 </target>
david_williamsad2097e2008-01-28 06:06:12 +000098 <target
99 name="unzipTests">
david_williamsf5f131a2007-03-17 06:12:13 +0000100
david_williams403beae2007-12-09 02:10:40 +0000101 <!--unzip the builds and junit tests
david_williams43089362008-03-25 05:43:38 +0000102 we use 'unzip' here, so we can continue on error, if desired.
david_williams403beae2007-12-09 02:10:40 +0000103 (such as if zip was not created, due to other failures or options).
104 -->
105 <exec
106 dir="${buildDirectory}/${buildLabel}"
107 executable="unzip"
108 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000109 <arg
david_williamsb064ea62008-03-28 00:41:31 +0000110 line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000111 </exec>
david_williams403beae2007-12-09 02:10:40 +0000112 <exec
113 dir="${buildDirectory}/${buildLabel}"
114 executable="unzip"
115 failonerror="false">
116 <arg
david_williamsb064ea62008-03-28 00:41:31 +0000117 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000118 </exec>
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="false">
123 <arg
david_williamsb064ea62008-03-28 00:41:31 +0000124 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000125 </exec>
david_williams403beae2007-12-09 02:10:40 +0000126 <exec
127 dir="${buildDirectory}/${buildLabel}"
128 executable="unzip"
129 failonerror="false">
130 <arg
david_williamsb064ea62008-03-28 00:41:31 +0000131 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000132 </exec>
133 <exec
134 dir="${buildDirectory}/${buildLabel}"
135 executable="unzip"
136 failonerror="false">
137 <arg
david_williamsb064ea62008-03-28 00:41:31 +0000138 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000139 </exec>
david_williams403beae2007-12-09 02:10:40 +0000140 </target>
david_williamsf5f131a2007-03-17 06:12:13 +0000141
david_williams403beae2007-12-09 02:10:40 +0000142 <!-- time out may need to be set/adjust for api or performance tests?
143 This testTimeLimit is the whole, overall limit on tests. There's a shorter
144 one for individual suites.
145
146 some common values, of milliseconds to more recognizable units:
david_williams64426ec2008-03-27 02:26:58 +0000147 14400000: 4 hours ... up'd to 4 hours after P2
david_williams403beae2007-12-09 02:10:40 +0000148 7200000: 2 hours
149 3600000: 1 hour
150 1800000: 30 minutes
151 600000: 10 minutes
152 -->
david_williams403beae2007-12-09 02:10:40 +0000153 <property
154 name="testTimeLimit"
david_williams64426ec2008-03-27 02:26:58 +0000155 value="14400000" />
david_williams403beae2007-12-09 02:10:40 +0000156 <property
157 name="testFailOnError"
158 value="false" />
david_williams403beae2007-12-09 02:10:40 +0000159 <target
160 name="runTestEclipse"
161 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000162 <property
163 name="test-vm"
164 value="${env.JAVA_5_HOME}/bin/java" />
165 <property
166 name="plugin-path"
david_williamsb064ea62008-03-28 00:41:31 +0000167 value="${testRoot}/eclipse/dropins/eclipse/plugins" />
david_williams403beae2007-12-09 02:10:40 +0000168 <property
169 name="vmargs"
david_williams8f4d7732008-03-27 23:08:26 +0000170 value="-Xms256m -Xmx512m -Dosgi.ws=${env.BASEWS} -Dosgi.os=${env.BASEOS} -Dosgi.arch=${env.BASEARCH} -Dws=${env.BASEWS} -Dos=${env.BASEOS} -Darch=${env.BASEARCH} -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 +0000171
david_williams4b093692007-03-19 09:41:32 +0000172
david_williams403beae2007-12-09 02:10:40 +0000173 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
174 <property
175 name="eclipse.home"
176 value="${testRoot}" />
david_williamsad2097e2008-01-28 06:06:12 +0000177 <echo
178 message="Running junits" />
david_williams9d23a9d2007-03-16 02:23:53 +0000179
david_williams403beae2007-12-09 02:10:40 +0000180 <!-- If there is not exactly one launcher in the stack,
181 we'd best fail fast, since we are not expecting that,
182 and may indicate an installation that would produce unpredictable
183 results -->
184 <!-- requires ant 1.7, and at this point, we're running 1.6 from
185 eclipse ...
186
187 <condition property="expectedNumberOfLaunchers">
188 <resourcecount when="equal" count="1" >
189 <fileset dir="${testRoot}/eclipse/plugins">
190 <include name="org.eclipse.equinox.launcher_*.jar" />
191 </fileset>
192 </resourcecount>
193 </condition>
194 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
195 -->
david_williamsfe1d0922008-03-25 03:01:25 +0000196
197
david_williams403beae2007-12-09 02:10:40 +0000198 <!--
199 Remember: using -debug for org.eclipse.ant.core.antRunner
200 produces ant debug info to be output ... which is a TON of stuff
201 -->
david_williams43089362008-03-25 05:43:38 +0000202 <echo
203 message="eclipse.launcher: ${eclipse.launcher}" />
david_williams403beae2007-12-09 02:10:40 +0000204 <java
205 taskname="unit-test-masterprocess"
206 fork="true"
207 resultProperty="wtpmasterjunitresult"
208 failonerror="false"
209 timeout="${testTimeLimit}"
210 dir="${testRoot}/eclipse"
211 jvm="${env.JAVA_5_HOME}/bin/java"
212 classname="org.eclipse.equinox.launcher.Main">
213 <classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000214 <fileset
215 dir="${testRoot}/eclipse/plugins">
216 <include
217 name="org.eclipse.equinox.launcher_*.jar" />
david_williams403beae2007-12-09 02:10:40 +0000218 </fileset>
219 </classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000220 <jvmarg
david_williamsad2097e2008-01-28 06:06:12 +0000221 value="-Xms512m" />
222 <jvmarg
223 value="-Xmx1024m" />
224 <jvmarg
225 value="-Dosgi.ws=${env.BASEWS}" />
226 <jvmarg
227 value="-Dosgi.os=${env.BASEOS}" />
228 <jvmarg
229 value="-Dosgi.arch=${env.BASEARCH}" />
230 <jvmarg
231 value="-Dws=${env.BASEWS}" />
232 <jvmarg
233 value="-Dos=${env.BASEOS}" />
234 <jvmarg
235 value="-Darch=${env.BASEARCH}" />
david_williams8f4d7732008-03-27 23:08:26 +0000236
david_williamsad2097e2008-01-28 06:06:12 +0000237 <jvmarg
238 value="-Dnoclean=true" />
239 <jvmarg
240 value="-DbuildBranch=${buildBranch}" />
241 <jvmarg
242 value="-DbuildType=${buildType}" />
243 <jvmarg
244 value="-DbuildId=${buildId}" />
david_williams26f3a5f2008-03-07 22:56:23 +0000245 <jvmarg
246 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
david_williamsad2097e2008-01-28 06:06:12 +0000247 <arg
248 value="-nosplash" />
249 <arg
250 value="-consolelog" />
251 <arg
252 value="-data" />
253 <arg
254 value="${testRoot}/overallTestWorkspace" />
255 <arg
256 value="-application" />
257 <arg
258 value="org.eclipse.ant.core.antRunner" />
259 <arg
260 value="-file" />
261 <arg
262 value="${testRoot}/test.xml" />
263 <arg
264 value="-logger" />
265 <arg
266 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000267 <env
268 key="DISPLAY"
269 value="${env.DISPLAY}" />
270 <redirector
271 output="${testRoot}/results/fullOutput.txt"
272 error="${testRoot}/results/fullErrorLog.txt" />
273 <sysproperty
274 key="build.home"
275 value="${env.BUILD_HOME}" />
276 <sysproperty
277 key="buildDirectory"
278 value="${buildDirectory}" />
279 <sysproperty
280 key="buildLabel"
281 value="${buildLabel}" />
282 <sysproperty
283 key="baseLocation"
284 value="${baseLocation}" />
285 <sysproperty
286 key="testRoot"
287 value="${testRoot}" />
288 <sysproperty
289 key="testDir"
290 value="${testRoot}" />
291 <sysproperty
292 key="perf.buildId"
293 value="${buildType}${date}-${time}" />
294 <sysproperty
295 key="eclipseBuilderDirectory"
296 value="${pde.builder.path}" />
297 <sysproperty
298 key="buildLabel"
david_williams26f3a5f2008-03-07 22:56:23 +0000299 value="${buildLabel}" />
david_williams403beae2007-12-09 02:10:40 +0000300 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000301 <echo
302 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000303 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000304 <target
305 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000306 <copy
307 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
308 overwrite="true"
309 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000310 <fileset
311 dir="${testRoot}/results">
312 <include
313 name="*output.txt" />
david_williams403beae2007-12-09 02:10:40 +0000314 </fileset>
315 </copy>
316 <copy
317 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
318 overwrite="true"
319 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000320 <fileset
321 dir="${testRoot}/results">
322 <include
323 name="*error.txt" />
david_williams403beae2007-12-09 02:10:40 +0000324 </fileset>
325 </copy>
326 <copy
327 file="${testRoot}/results/fullOutput.txt"
328 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
329 overwrite="true"
330 failonerror="false">
331 </copy>
332 <copy
333 file="${testRoot}/results/fullErrorLog.txt"
334 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
335 overwrite="true"
336 failonerror="false">
337 </copy>
david_williams403beae2007-12-09 02:10:40 +0000338 <copy
339 todir="${buildDirectory}/${buildLabel}/testResults/xml"
340 overwrite="true"
341 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000342 <fileset
343 dir="${testRoot}/results/xml">
344 <include
345 name="*.xml" />
david_williams403beae2007-12-09 02:10:40 +0000346 </fileset>
347 </copy>
348 <copy
349 todir="${buildDirectory}/${buildLabel}/testResults/html"
350 overwrite="true"
351 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000352 <fileset
353 dir="${testRoot}/results/html">
354 <include
355 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000356 </fileset>
357 </copy>
358 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000359</project>