blob: f5f44ce6c879ff8eed6abd1b40f59d1661ac2776 [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_williams43089362008-03-25 05:43:38 +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_williams43089362008-03-25 05:43:38 +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
david_williams43089362008-03-25 05:43:38 +000065 dir="${test.component.dir}/testScripts" />
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
david_williams43089362008-03-25 05:43:38 +000098 we use 'unzip' here, so we can continue on error, if desired.
david_williams403beae2007-12-09 02:10:40 +000099 (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
david_williamsfe1d0922008-03-25 03:01:25 +0000106 line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
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
david_williamsfe1d0922008-03-25 03:01:25 +0000113 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000114 </exec>
115 <exec
116 dir="${buildDirectory}/${buildLabel}"
117 executable="unzip"
118 failonerror="false">
119 <arg
david_williamsfe1d0922008-03-25 03:01:25 +0000120 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000121 </exec>
david_williams403beae2007-12-09 02:10:40 +0000122 <exec
123 dir="${buildDirectory}/${buildLabel}"
124 executable="unzip"
125 failonerror="false">
126 <arg
david_williamsfe1d0922008-03-25 03:01:25 +0000127 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000128 </exec>
129 <exec
130 dir="${buildDirectory}/${buildLabel}"
131 executable="unzip"
132 failonerror="false">
133 <arg
david_williamsfe1d0922008-03-25 03:01:25 +0000134 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}/eclipse/dropins" />
david_williams403beae2007-12-09 02:10:40 +0000135 </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"
david_williamsfe1d0922008-03-25 03:01:25 +0000162 value="${testRoot}/eclipse/dropins/eclipse/plugins" />
david_williams403beae2007-12-09 02:10:40 +0000163 <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 -->
david_williamsfe1d0922008-03-25 03:01:25 +0000191
192
david_williams403beae2007-12-09 02:10:40 +0000193 <!--
194 Remember: using -debug for org.eclipse.ant.core.antRunner
195 produces ant debug info to be output ... which is a TON of stuff
196 -->
david_williams43089362008-03-25 05:43:38 +0000197 <echo
198 message="eclipse.launcher: ${eclipse.launcher}" />
david_williams403beae2007-12-09 02:10:40 +0000199 <java
200 taskname="unit-test-masterprocess"
201 fork="true"
202 resultProperty="wtpmasterjunitresult"
203 failonerror="false"
204 timeout="${testTimeLimit}"
205 dir="${testRoot}/eclipse"
206 jvm="${env.JAVA_5_HOME}/bin/java"
207 classname="org.eclipse.equinox.launcher.Main">
208 <classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000209 <fileset
210 dir="${testRoot}/eclipse/plugins">
211 <include
212 name="org.eclipse.equinox.launcher_*.jar" />
david_williams403beae2007-12-09 02:10:40 +0000213 </fileset>
214 </classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000215 <jvmarg
david_williamsad2097e2008-01-28 06:06:12 +0000216 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}" />
david_williams26f3a5f2008-03-07 22:56:23 +0000241 <jvmarg
242 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
david_williamsad2097e2008-01-28 06:06:12 +0000243 <arg
244 value="-nosplash" />
245 <arg
246 value="-consolelog" />
247 <arg
248 value="-data" />
249 <arg
250 value="${testRoot}/overallTestWorkspace" />
251 <arg
252 value="-application" />
253 <arg
254 value="org.eclipse.ant.core.antRunner" />
255 <arg
256 value="-file" />
257 <arg
258 value="${testRoot}/test.xml" />
259 <arg
260 value="-logger" />
261 <arg
262 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000263 <env
264 key="DISPLAY"
265 value="${env.DISPLAY}" />
266 <redirector
267 output="${testRoot}/results/fullOutput.txt"
268 error="${testRoot}/results/fullErrorLog.txt" />
269 <sysproperty
270 key="build.home"
271 value="${env.BUILD_HOME}" />
272 <sysproperty
273 key="buildDirectory"
274 value="${buildDirectory}" />
275 <sysproperty
276 key="buildLabel"
277 value="${buildLabel}" />
278 <sysproperty
279 key="baseLocation"
280 value="${baseLocation}" />
281 <sysproperty
282 key="testRoot"
283 value="${testRoot}" />
284 <sysproperty
285 key="testDir"
286 value="${testRoot}" />
287 <sysproperty
288 key="perf.buildId"
289 value="${buildType}${date}-${time}" />
290 <sysproperty
291 key="eclipseBuilderDirectory"
292 value="${pde.builder.path}" />
293 <sysproperty
294 key="buildLabel"
david_williams26f3a5f2008-03-07 22:56:23 +0000295 value="${buildLabel}" />
david_williams403beae2007-12-09 02:10:40 +0000296 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000297 <echo
298 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000299 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000300 <target
301 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000302 <copy
303 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
304 overwrite="true"
305 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000306 <fileset
307 dir="${testRoot}/results">
308 <include
309 name="*output.txt" />
david_williams403beae2007-12-09 02:10:40 +0000310 </fileset>
311 </copy>
312 <copy
313 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
314 overwrite="true"
315 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000316 <fileset
317 dir="${testRoot}/results">
318 <include
319 name="*error.txt" />
david_williams403beae2007-12-09 02:10:40 +0000320 </fileset>
321 </copy>
322 <copy
323 file="${testRoot}/results/fullOutput.txt"
324 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
325 overwrite="true"
326 failonerror="false">
327 </copy>
328 <copy
329 file="${testRoot}/results/fullErrorLog.txt"
330 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
331 overwrite="true"
332 failonerror="false">
333 </copy>
david_williams403beae2007-12-09 02:10:40 +0000334 <copy
335 todir="${buildDirectory}/${buildLabel}/testResults/xml"
336 overwrite="true"
337 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000338 <fileset
339 dir="${testRoot}/results/xml">
340 <include
341 name="*.xml" />
david_williams403beae2007-12-09 02:10:40 +0000342 </fileset>
343 </copy>
344 <copy
345 todir="${buildDirectory}/${buildLabel}/testResults/html"
346 overwrite="true"
347 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000348 <fileset
349 dir="${testRoot}/results/html">
350 <include
351 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000352 </fileset>
353 </copy>
354 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000355</project>