blob: 4d9654b1cf995ca4d3a6c81d1bbb4e264274167b [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
david_williamsad2097e2008-01-28 06:06:12 +0000212 value="-Xms512m" />
213 <jvmarg
214 value="-Xmx1024m" />
215 <jvmarg
216 value="-Dosgi.ws=${env.BASEWS}" />
217 <jvmarg
218 value="-Dosgi.os=${env.BASEOS}" />
219 <jvmarg
220 value="-Dosgi.arch=${env.BASEARCH}" />
221 <jvmarg
222 value="-Dws=${env.BASEWS}" />
223 <jvmarg
224 value="-Dos=${env.BASEOS}" />
225 <jvmarg
226 value="-Darch=${env.BASEARCH}" />
227 <jvmarg
228 value="-Dosgi.clean=true" />
229 <jvmarg
230 value="-Dnoclean=true" />
231 <jvmarg
232 value="-DbuildBranch=${buildBranch}" />
233 <jvmarg
234 value="-DbuildType=${buildType}" />
235 <jvmarg
236 value="-DbuildId=${buildId}" />
david_williams26f3a5f2008-03-07 22:56:23 +0000237 <jvmarg
238 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
david_williamsad2097e2008-01-28 06:06:12 +0000239 <arg
240 value="-nosplash" />
241 <arg
242 value="-consolelog" />
243 <arg
244 value="-data" />
245 <arg
246 value="${testRoot}/overallTestWorkspace" />
247 <arg
248 value="-application" />
249 <arg
250 value="org.eclipse.ant.core.antRunner" />
251 <arg
252 value="-file" />
253 <arg
254 value="${testRoot}/test.xml" />
255 <arg
256 value="-logger" />
257 <arg
258 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000259 <env
260 key="DISPLAY"
261 value="${env.DISPLAY}" />
262 <redirector
263 output="${testRoot}/results/fullOutput.txt"
264 error="${testRoot}/results/fullErrorLog.txt" />
265 <sysproperty
266 key="build.home"
267 value="${env.BUILD_HOME}" />
268 <sysproperty
269 key="buildDirectory"
270 value="${buildDirectory}" />
271 <sysproperty
272 key="buildLabel"
273 value="${buildLabel}" />
274 <sysproperty
275 key="baseLocation"
276 value="${baseLocation}" />
277 <sysproperty
278 key="testRoot"
279 value="${testRoot}" />
280 <sysproperty
281 key="testDir"
282 value="${testRoot}" />
283 <sysproperty
284 key="perf.buildId"
285 value="${buildType}${date}-${time}" />
286 <sysproperty
287 key="eclipseBuilderDirectory"
288 value="${pde.builder.path}" />
289 <sysproperty
290 key="buildLabel"
david_williams26f3a5f2008-03-07 22:56:23 +0000291 value="${buildLabel}" />
david_williams403beae2007-12-09 02:10:40 +0000292 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000293 <echo
294 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000295 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000296 <target
297 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000298 <copy
299 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
300 overwrite="true"
301 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000302 <fileset
303 dir="${testRoot}/results">
304 <include
305 name="*output.txt" />
david_williams403beae2007-12-09 02:10:40 +0000306 </fileset>
307 </copy>
308 <copy
309 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
310 overwrite="true"
311 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000312 <fileset
313 dir="${testRoot}/results">
314 <include
315 name="*error.txt" />
david_williams403beae2007-12-09 02:10:40 +0000316 </fileset>
317 </copy>
318 <copy
319 file="${testRoot}/results/fullOutput.txt"
320 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
321 overwrite="true"
322 failonerror="false">
323 </copy>
324 <copy
325 file="${testRoot}/results/fullErrorLog.txt"
326 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
327 overwrite="true"
328 failonerror="false">
329 </copy>
david_williams403beae2007-12-09 02:10:40 +0000330 <copy
331 todir="${buildDirectory}/${buildLabel}/testResults/xml"
332 overwrite="true"
333 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000334 <fileset
335 dir="${testRoot}/results/xml">
336 <include
337 name="*.xml" />
david_williams403beae2007-12-09 02:10:40 +0000338 </fileset>
339 </copy>
340 <copy
341 todir="${buildDirectory}/${buildLabel}/testResults/html"
342 overwrite="true"
343 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000344 <fileset
345 dir="${testRoot}/results/html">
346 <include
347 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000348 </fileset>
349 </copy>
350 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000351</project>