blob: 0087c814410e0aec14a33eaa3de61a41bdba5a5e [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_williams421f20d2008-05-02 03:55:11 +0000110 line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
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_williams421f20d2008-05-02 03:55:11 +0000117 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
david_williams403beae2007-12-09 02:10:40 +0000118 </exec>
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="false">
123 <arg
david_williams421f20d2008-05-02 03:55:11 +0000124 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
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_williams421f20d2008-05-02 03:55:11 +0000131 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
david_williams403beae2007-12-09 02:10:40 +0000132 </exec>
133 <exec
134 dir="${buildDirectory}/${buildLabel}"
135 executable="unzip"
136 failonerror="false">
137 <arg
david_williams421f20d2008-05-02 03:55:11 +0000138 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
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_williams421f20d2008-05-02 03:55:11 +0000167 value="${testRoot}${dropinsFolder}/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
david_williamscf432b52008-05-13 04:58:34 +0000246 value="-Dprojectname=${projectname}" />
247 <jvmarg
david_williams26f3a5f2008-03-07 22:56:23 +0000248 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
david_williamsad2097e2008-01-28 06:06:12 +0000249 <arg
250 value="-nosplash" />
251 <arg
252 value="-consolelog" />
253 <arg
254 value="-data" />
255 <arg
256 value="${testRoot}/overallTestWorkspace" />
257 <arg
258 value="-application" />
259 <arg
260 value="org.eclipse.ant.core.antRunner" />
261 <arg
262 value="-file" />
263 <arg
264 value="${testRoot}/test.xml" />
265 <arg
266 value="-logger" />
267 <arg
268 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000269 <env
270 key="DISPLAY"
271 value="${env.DISPLAY}" />
272 <redirector
273 output="${testRoot}/results/fullOutput.txt"
274 error="${testRoot}/results/fullErrorLog.txt" />
275 <sysproperty
276 key="build.home"
277 value="${env.BUILD_HOME}" />
278 <sysproperty
279 key="buildDirectory"
280 value="${buildDirectory}" />
281 <sysproperty
282 key="buildLabel"
283 value="${buildLabel}" />
284 <sysproperty
285 key="baseLocation"
286 value="${baseLocation}" />
287 <sysproperty
288 key="testRoot"
289 value="${testRoot}" />
290 <sysproperty
291 key="testDir"
292 value="${testRoot}" />
293 <sysproperty
294 key="perf.buildId"
295 value="${buildType}${date}-${time}" />
296 <sysproperty
297 key="eclipseBuilderDirectory"
298 value="${pde.builder.path}" />
299 <sysproperty
300 key="buildLabel"
david_williams26f3a5f2008-03-07 22:56:23 +0000301 value="${buildLabel}" />
david_williams403beae2007-12-09 02:10:40 +0000302 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000303 <echo
304 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000305 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000306 <target
307 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000308 <copy
309 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
310 overwrite="true"
311 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000312 <fileset
313 dir="${testRoot}/results">
314 <include
315 name="*output.txt" />
david_williams403beae2007-12-09 02:10:40 +0000316 </fileset>
317 </copy>
318 <copy
319 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
320 overwrite="true"
321 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000322 <fileset
323 dir="${testRoot}/results">
324 <include
325 name="*error.txt" />
david_williams403beae2007-12-09 02:10:40 +0000326 </fileset>
327 </copy>
328 <copy
329 file="${testRoot}/results/fullOutput.txt"
330 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
331 overwrite="true"
332 failonerror="false">
333 </copy>
334 <copy
335 file="${testRoot}/results/fullErrorLog.txt"
336 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
337 overwrite="true"
338 failonerror="false">
339 </copy>
david_williams403beae2007-12-09 02:10:40 +0000340 <copy
341 todir="${buildDirectory}/${buildLabel}/testResults/xml"
342 overwrite="true"
343 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000344 <fileset
345 dir="${testRoot}/results/xml">
346 <include
347 name="*.xml" />
david_williams403beae2007-12-09 02:10:40 +0000348 </fileset>
349 </copy>
350 <copy
351 todir="${buildDirectory}/${buildLabel}/testResults/html"
352 overwrite="true"
353 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000354 <fileset
355 dir="${testRoot}/results/html">
356 <include
357 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000358 </fileset>
359 </copy>
360 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000361</project>