blob: 59f5e41f2f8c872d358dcb933a27993f7cdcdbc0 [file] [log] [blame]
david_williams403beae2007-12-09 02:10:40 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
david_williams8e4dc9c2008-07-06 08:08:58 +00004 <!--
5 Note to be cross-platform, "environment variables" are only
6 appropriate for some variables, e.g. ones we set, since
7 properties are case sensitive, even if the environment variables
8 on your operating system are not, e.g. it will be ${env.Path}
9 not ${env.PATH} on Windows
10 -->
david_williamsad2097e2008-01-28 06:06:12 +000011 <property
david_williams8e4dc9c2008-07-06 08:08:58 +000012 environment="env"/>
david_williams2f43da22009-07-22 04:25:24 +000013 <fail
14 message="testRoot must be set for this task"
15 unless="testRoot"/>
16 <!-- required to get proper value of dropinsFolder -->
david_williams8e4dc9c2008-07-06 08:08:58 +000017 <property
18 name="keyCfgFile"
19 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
20 <echo
david_williamsd1184892008-07-07 02:45:47 +000021 level="debug"
david_williams8e4dc9c2008-07-06 08:08:58 +000022 message="keyCfgFile: ${keyCfgFile}"/>
23 <property
24 file="${keyCfgFile}"/>
david_williams2f43da22009-07-22 04:25:24 +000025
26 <!-- if not otherwise set, assume 'all' tests -->
27 <property
28 name="testTarget"
29 value="all"/>
30 <!--
31 typcially already set, but in case of standalone tests, may not
32 be
33 -->
34 <property
35 name="buildLabel"
36 value="${buildType}-${buildId}-${timestamp}"/>
37
ndaib8cedc82005-09-13 18:00:32 +000038
david_williams43089362008-03-25 05:43:38 +000039 <!--
40 Steps to do after the build is done.
41 -->
david_williamsad2097e2008-01-28 06:06:12 +000042 <target
43 name="test">
david_williams403beae2007-12-09 02:10:40 +000044 <dirname
45 file="${ant.file}"
david_williams8e4dc9c2008-07-06 08:08:58 +000046 property="currentDirectory"/>
david_williams403beae2007-12-09 02:10:40 +000047 <ant
48 antfile="${ant.file}"
49 target="runTest"
david_williams8e4dc9c2008-07-06 08:08:58 +000050 dir="${currentDirectory}"/>
david_williams403beae2007-12-09 02:10:40 +000051 </target>
ndaib8cedc82005-09-13 18:00:32 +000052
david_williams43089362008-03-25 05:43:38 +000053 <!--
54 Steps to do to test the build results
55 -->
david_williamsad2097e2008-01-28 06:06:12 +000056 <target
57 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000058 <dirname
59 file="${ant.file}"
david_williams8e4dc9c2008-07-06 08:08:58 +000060 property="test.component.dir"/>
david_williamsad2097e2008-01-28 06:06:12 +000061 <ant
david_williams8e4dc9c2008-07-06 08:08:58 +000062 antfile="${wtp.builder.home}/scripts/build/label.xml"/>
david_williamsad2097e2008-01-28 06:06:12 +000063 <property
david_williams8e4dc9c2008-07-06 08:08:58 +000064 file="${buildDirectory}/label.properties"/>
david_williamsad2097e2008-01-28 06:06:12 +000065 <property
david_williams8e4dc9c2008-07-06 08:08:58 +000066 file="${wtp.builder.home}/build.properties"/>
david_williams403beae2007-12-09 02:10:40 +000067 <fail
68 message="testRoot must be set for this task"
david_williams8e4dc9c2008-07-06 08:08:58 +000069 unless="testRoot"/>
david_williamsad2097e2008-01-28 06:06:12 +000070 <mkdir
david_williams8e4dc9c2008-07-06 08:08:58 +000071 dir="${testRoot}"/>
david_williamsf5f131a2007-03-17 06:12:13 +000072
david_williams403beae2007-12-09 02:10:40 +000073 <!-- if results already exist, delete them -->
74 <delete
75 dir="${testRoot}/results"
david_williams8e4dc9c2008-07-06 08:08:58 +000076 failOnError="false"/>
david_williamsad2097e2008-01-28 06:06:12 +000077 <mkdir
david_williams8e4dc9c2008-07-06 08:08:58 +000078 dir="${testRoot}/results"/>
david_williamsad2097e2008-01-28 06:06:12 +000079 <mkdir
david_williams8e4dc9c2008-07-06 08:08:58 +000080 dir="${testRoot}/results/consolelogs"/>
david_williamsad2097e2008-01-28 06:06:12 +000081 <mkdir
david_williams8e4dc9c2008-07-06 08:08:58 +000082 dir="${testRoot}/results/consolelogs/metadata-logs"/>
david_williamsad2097e2008-01-28 06:06:12 +000083 <mkdir
david_williams8e4dc9c2008-07-06 08:08:58 +000084 dir="${testRoot}/results/consolelogs/configuration-logs"/>
david_williams403beae2007-12-09 02:10:40 +000085 <copy
86 todir="${testRoot}"
87 overwrite="true">
david_williamsad2097e2008-01-28 06:06:12 +000088 <fileset
david_williams8e4dc9c2008-07-06 08:08:58 +000089 dir="${test.component.dir}/testScripts"/>
david_williams403beae2007-12-09 02:10:40 +000090 </copy>
david_williams403beae2007-12-09 02:10:40 +000091 <echo
david_williams8e4dc9c2008-07-06 08:08:58 +000092 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williams403beae2007-12-09 02:10:40 +000093 <ant
94 antfile="${test.component.dir}/testdependency.xml"
95 target="get">
96 <property
97 name="dependency.properties"
david_williams8e4dc9c2008-07-06 08:08:58 +000098 value="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties"/>
david_williams403beae2007-12-09 02:10:40 +000099 <property
100 name="base.install.dir"
david_williams8e4dc9c2008-07-06 08:08:58 +0000101 value="${testRoot}"/>
david_williams403beae2007-12-09 02:10:40 +0000102 </ant>
david_williamsad2097e2008-01-28 06:06:12 +0000103 <antcall
david_williams8e4dc9c2008-07-06 08:08:58 +0000104 target="unzipTests"/>
david_williamsad2097e2008-01-28 06:06:12 +0000105 <antcall
106 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000107 </antcall>
david_williamsad2097e2008-01-28 06:06:12 +0000108 <antcall
109 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000110 </antcall>
david_williams403beae2007-12-09 02:10:40 +0000111 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000112 <target
113 name="unzipTests">
david_williams8e4dc9c2008-07-06 08:08:58 +0000114 <!--
115 unzip the builds and junit tests we use 'unzip' here, so we
116 can continue on error, if desired. (such as if zip was not
117 created, due to other failures or options).
david_williams403beae2007-12-09 02:10:40 +0000118 -->
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000123 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000124 line="-o -qq wtp-sdk-${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_williams8e4dc9c2008-07-06 08:08:58 +0000131 line="-o -qq wtp-wst-Automated-Tests-${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_williams8e4dc9c2008-07-06 08:08:58 +0000138 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams403beae2007-12-09 02:10:40 +0000139 </exec>
david_williams403beae2007-12-09 02:10:40 +0000140 <exec
141 dir="${buildDirectory}/${buildLabel}"
142 executable="unzip"
143 failonerror="false">
144 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000145 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams403beae2007-12-09 02:10:40 +0000146 </exec>
147 <exec
148 dir="${buildDirectory}/${buildLabel}"
149 executable="unzip"
150 failonerror="false">
151 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000152 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams403beae2007-12-09 02:10:40 +0000153 </exec>
david_williams403beae2007-12-09 02:10:40 +0000154 </target>
david_williams8e4dc9c2008-07-06 08:08:58 +0000155 <!--
156 time out may need to be set/adjust for api or performance tests?
157 This testTimeLimit is the whole, overall limit on tests. There's
158 a shorter one for individual suites. some common values, of
david_williams2f43da22009-07-22 04:25:24 +0000159 milliseconds to more recognizable units: 14400000: 4 hours
160 7200000: 2 hours 3600000: 1 hour 1800000: 30 minutes 600000: 10
161 minutes
david_williams403beae2007-12-09 02:10:40 +0000162 -->
david_williams403beae2007-12-09 02:10:40 +0000163 <property
164 name="testTimeLimit"
david_williams8e4dc9c2008-07-06 08:08:58 +0000165 value="14400000"/>
david_williams403beae2007-12-09 02:10:40 +0000166 <property
167 name="testFailOnError"
david_williams8e4dc9c2008-07-06 08:08:58 +0000168 value="false"/>
david_williams403beae2007-12-09 02:10:40 +0000169 <target
170 name="runTestEclipse"
171 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000172 <property
173 name="test-vm"
david_williamsdbd9d832009-01-13 06:37:49 +0000174 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams403beae2007-12-09 02:10:40 +0000175 <property
176 name="plugin-path"
david_williams8e4dc9c2008-07-06 08:08:58 +0000177 value="${testRoot}${dropinsFolder}/eclipse/plugins"/>
david_williams403beae2007-12-09 02:10:40 +0000178 <property
179 name="vmargs"
david_williams3ac3b032008-09-23 05:23:34 +0000180 value="-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_williams8e4dc9c2008-07-06 08:08:58 +0000181 <!--
182 set path to eclipse folder. If local folder, use '.';
183 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
184 -->
david_williams403beae2007-12-09 02:10:40 +0000185 <property
186 name="eclipse.home"
david_williams8e4dc9c2008-07-06 08:08:58 +0000187 value="${testRoot}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000188 <echo
david_williams2f43da22009-07-22 04:25:24 +0000189 message="testTarget: ${testTarget}"/>
190 <echo
191 message="plugin-path: ${plugin-path}"/>
192 <echo
david_williams8e4dc9c2008-07-06 08:08:58 +0000193 message="Running junits"/>
194 <!--
195 If there is not exactly one launcher in the stack, we'd best
196 fail fast, since we are not expecting that, and may indicate
197 an installation that would produce unpredictable results
david_williams403beae2007-12-09 02:10:40 +0000198 -->
david_williams8e4dc9c2008-07-06 08:08:58 +0000199 <!--
200 requires ant 1.7, and at this point, we're running 1.6 from
201 eclipse ... <condition property="expectedNumberOfLaunchers">
202 <resourcecount when="equal" count="1" > <fileset
203 dir="${testRoot}/eclipse/plugins"> <include
204 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
205 </resourcecount> </condition> <fail message="Did not find
206 expected number of launcher jars. Check installation."
207 unless="expectedNumberOfLaunchers" />
208 -->
209 <!--
210 Remember: using -debug for org.eclipse.ant.core.antRunner
211 produces ant debug info to be output ... which is a TON of
212 stuff
david_williams403beae2007-12-09 02:10:40 +0000213 -->
214 <java
215 taskname="unit-test-masterprocess"
216 fork="true"
217 resultProperty="wtpmasterjunitresult"
218 failonerror="false"
219 timeout="${testTimeLimit}"
220 dir="${testRoot}/eclipse"
david_williamsdbd9d832009-01-13 06:37:49 +0000221 jvm="${env.JAVA_6_HOME}/bin/java"
david_williams403beae2007-12-09 02:10:40 +0000222 classname="org.eclipse.equinox.launcher.Main">
223 <classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000224 <fileset
225 dir="${testRoot}/eclipse/plugins">
226 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000227 name="org.eclipse.equinox.launcher_*.jar"/>
david_williams403beae2007-12-09 02:10:40 +0000228 </fileset>
229 </classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000230 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000231 value="-Xverify"/>
david_williams015c81c2008-05-18 05:09:45 +0000232 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000233 value="-Dosgi.ws=${env.BASEWS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000234 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000235 value="-Dosgi.os=${env.BASEOS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000236 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000237 value="-Dosgi.arch=${env.BASEARCH}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000238 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000239 value="-Dws=${env.BASEWS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000240 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000241 value="-Dos=${env.BASEOS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000242 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000243 value="-Darch=${env.BASEARCH}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000244 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000245 value="-Dnoclean=true"/>
david_williamsad2097e2008-01-28 06:06:12 +0000246 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000247 value="-DbuildBranch=${buildBranch}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000248 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000249 value="-DbuildType=${buildType}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000250 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000251 value="-DbuildId=${buildId}"/>
david_williams26f3a5f2008-03-07 22:56:23 +0000252 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000253 value="-Dprojectname=${projectname}"/>
david_williamscf432b52008-05-13 04:58:34 +0000254 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000255 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williams2f43da22009-07-22 04:25:24 +0000256 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000257 value="-nosplash"/>
david_williamsad2097e2008-01-28 06:06:12 +0000258 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000259 value="-consolelog"/>
david_williamsad2097e2008-01-28 06:06:12 +0000260 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000261 value="-data"/>
david_williamsad2097e2008-01-28 06:06:12 +0000262 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000263 value="${testRoot}/overallTestWorkspace"/>
david_williamsad2097e2008-01-28 06:06:12 +0000264 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000265 value="-application"/>
david_williamsad2097e2008-01-28 06:06:12 +0000266 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000267 value="org.eclipse.ant.core.antRunner"/>
david_williamsad2097e2008-01-28 06:06:12 +0000268 <arg
david_williams2f43da22009-07-22 04:25:24 +0000269 value="-verbose"/>
david_williamsad2097e2008-01-28 06:06:12 +0000270 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000271 value="-logger"/>
david_williamsad2097e2008-01-28 06:06:12 +0000272 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000273 value="org.apache.tools.ant.DefaultLogger"/>
david_williams2f43da22009-07-22 04:25:24 +0000274 <arg
275 value="-file"/>
276 <arg
277 value="${testRoot}/test.xml"/>
278 <arg
279 value="${testTarget}"/>
280
281 <!-- make sure our forked env has a DISPLAY -->
david_williams403beae2007-12-09 02:10:40 +0000282 <env
283 key="DISPLAY"
david_williams8e4dc9c2008-07-06 08:08:58 +0000284 value="${env.DISPLAY}"/>
david_williams403beae2007-12-09 02:10:40 +0000285 <redirector
286 output="${testRoot}/results/fullOutput.txt"
david_williams8e4dc9c2008-07-06 08:08:58 +0000287 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2f43da22009-07-22 04:25:24 +0000288 <jvmarg
289 value="-Dbuild.home=${env.BUILD_HOME}"/>
290 <jvmarg
291 value="-DbuildDirectory=${buildDirectory}"/>
292 <jvmarg
293 value="-DbuildLabel=${buildLabel}"/>
294 <jvmarg
295 value="-DbaseLocation=${baseLocation}"/>
296 <jvmarg
297 value="-DtestRoot=${testRoot}"/>
298 <jvmarg
299 value="-DtestDir=${testRoot}"/>
300 <jvmarg
301 value="-Dperf.buildId=${buildType}${date}-${time}"/>
302 <jvmarg
303 value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
304 <jvmarg
305 value="-DbuildLabel=${buildLabel}"/>
306 <jvmarg
307 value="-Dplugin-path=${plugin-path}"/>
david_williams403beae2007-12-09 02:10:40 +0000308 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000309 <echo
david_williams8e4dc9c2008-07-06 08:08:58 +0000310 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams403beae2007-12-09 02:10:40 +0000311 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000312 <target
313 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000314 <copy
315 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
316 overwrite="true"
317 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000318 <fileset
319 dir="${testRoot}/results">
320 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000321 name="*output.txt"/>
david_williams403beae2007-12-09 02:10:40 +0000322 </fileset>
323 </copy>
324 <copy
325 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
326 overwrite="true"
327 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000328 <fileset
329 dir="${testRoot}/results">
330 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000331 name="*error.txt"/>
david_williams403beae2007-12-09 02:10:40 +0000332 </fileset>
333 </copy>
334 <copy
335 file="${testRoot}/results/fullOutput.txt"
336 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
337 overwrite="true"
338 failonerror="false">
339 </copy>
340 <copy
341 file="${testRoot}/results/fullErrorLog.txt"
342 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
343 overwrite="true"
344 failonerror="false">
345 </copy>
david_williams403beae2007-12-09 02:10:40 +0000346 <copy
347 todir="${buildDirectory}/${buildLabel}/testResults/xml"
348 overwrite="true"
349 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000350 <fileset
351 dir="${testRoot}/results/xml">
352 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000353 name="*.xml"/>
david_williams403beae2007-12-09 02:10:40 +0000354 </fileset>
355 </copy>
356 <copy
357 todir="${buildDirectory}/${buildLabel}/testResults/html"
358 overwrite="true"
359 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000360 <fileset
361 dir="${testRoot}/results/html">
362 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000363 name="*.html"/>
david_williams403beae2007-12-09 02:10:40 +0000364 </fileset>
365 </copy>
366 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000367</project>