blob: 45eb0ba232e5266c48d16f5e0299034915a8b34c [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_williams0f242892009-07-23 00:24:10 +0000159 milliseconds to more recognizable units:
160 14400000: 4 hours
161 7200000: 2 hours
162 3600000: 1 hour
163 1800000: 30 minutes
164 600000: 10 minutes
david_williams403beae2007-12-09 02:10:40 +0000165 -->
david_williams403beae2007-12-09 02:10:40 +0000166 <property
167 name="testTimeLimit"
david_williams8e4dc9c2008-07-06 08:08:58 +0000168 value="14400000"/>
david_williams403beae2007-12-09 02:10:40 +0000169 <property
170 name="testFailOnError"
david_williams8e4dc9c2008-07-06 08:08:58 +0000171 value="false"/>
david_williams403beae2007-12-09 02:10:40 +0000172 <target
173 name="runTestEclipse"
174 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000175 <property
176 name="test-vm"
david_williamsdbd9d832009-01-13 06:37:49 +0000177 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams403beae2007-12-09 02:10:40 +0000178 <property
179 name="plugin-path"
david_williams8e4dc9c2008-07-06 08:08:58 +0000180 value="${testRoot}${dropinsFolder}/eclipse/plugins"/>
david_williams403beae2007-12-09 02:10:40 +0000181 <property
182 name="vmargs"
david_williams3ac3b032008-09-23 05:23:34 +0000183 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 +0000184 <!--
185 set path to eclipse folder. If local folder, use '.';
186 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
187 -->
david_williams403beae2007-12-09 02:10:40 +0000188 <property
189 name="eclipse.home"
david_williams8e4dc9c2008-07-06 08:08:58 +0000190 value="${testRoot}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000191 <echo
david_williams2f43da22009-07-22 04:25:24 +0000192 message="testTarget: ${testTarget}"/>
193 <echo
194 message="plugin-path: ${plugin-path}"/>
195 <echo
david_williams8e4dc9c2008-07-06 08:08:58 +0000196 message="Running junits"/>
197 <!--
198 If there is not exactly one launcher in the stack, we'd best
199 fail fast, since we are not expecting that, and may indicate
200 an installation that would produce unpredictable results
david_williams403beae2007-12-09 02:10:40 +0000201 -->
david_williams8e4dc9c2008-07-06 08:08:58 +0000202 <!--
203 requires ant 1.7, and at this point, we're running 1.6 from
204 eclipse ... <condition property="expectedNumberOfLaunchers">
205 <resourcecount when="equal" count="1" > <fileset
206 dir="${testRoot}/eclipse/plugins"> <include
207 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
208 </resourcecount> </condition> <fail message="Did not find
209 expected number of launcher jars. Check installation."
210 unless="expectedNumberOfLaunchers" />
211 -->
212 <!--
213 Remember: using -debug for org.eclipse.ant.core.antRunner
214 produces ant debug info to be output ... which is a TON of
215 stuff
david_williams403beae2007-12-09 02:10:40 +0000216 -->
217 <java
218 taskname="unit-test-masterprocess"
219 fork="true"
220 resultProperty="wtpmasterjunitresult"
221 failonerror="false"
222 timeout="${testTimeLimit}"
223 dir="${testRoot}/eclipse"
david_williamsdbd9d832009-01-13 06:37:49 +0000224 jvm="${env.JAVA_6_HOME}/bin/java"
david_williams403beae2007-12-09 02:10:40 +0000225 classname="org.eclipse.equinox.launcher.Main">
226 <classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000227 <fileset
228 dir="${testRoot}/eclipse/plugins">
229 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000230 name="org.eclipse.equinox.launcher_*.jar"/>
david_williams403beae2007-12-09 02:10:40 +0000231 </fileset>
232 </classpath>
david_williamsad2097e2008-01-28 06:06:12 +0000233 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000234 value="-Xverify"/>
david_williams015c81c2008-05-18 05:09:45 +0000235 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000236 value="-Dosgi.ws=${env.BASEWS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000237 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000238 value="-Dosgi.os=${env.BASEOS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000239 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000240 value="-Dosgi.arch=${env.BASEARCH}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000241 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000242 value="-Dws=${env.BASEWS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000243 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000244 value="-Dos=${env.BASEOS}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000245 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000246 value="-Darch=${env.BASEARCH}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000247 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000248 value="-Dnoclean=true"/>
david_williamsad2097e2008-01-28 06:06:12 +0000249 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000250 value="-DbuildBranch=${buildBranch}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000251 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000252 value="-DbuildType=${buildType}"/>
david_williamsad2097e2008-01-28 06:06:12 +0000253 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000254 value="-DbuildId=${buildId}"/>
david_williams26f3a5f2008-03-07 22:56:23 +0000255 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000256 value="-Dprojectname=${projectname}"/>
david_williamscf432b52008-05-13 04:58:34 +0000257 <jvmarg
david_williams8e4dc9c2008-07-06 08:08:58 +0000258 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williams2f43da22009-07-22 04:25:24 +0000259 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000260 value="-nosplash"/>
david_williamsad2097e2008-01-28 06:06:12 +0000261 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000262 value="-consolelog"/>
david_williamsad2097e2008-01-28 06:06:12 +0000263 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000264 value="-data"/>
david_williamsad2097e2008-01-28 06:06:12 +0000265 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000266 value="${testRoot}/overallTestWorkspace"/>
david_williamsad2097e2008-01-28 06:06:12 +0000267 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000268 value="-application"/>
david_williamsad2097e2008-01-28 06:06:12 +0000269 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000270 value="org.eclipse.ant.core.antRunner"/>
david_williamsad2097e2008-01-28 06:06:12 +0000271 <arg
david_williams2f43da22009-07-22 04:25:24 +0000272 value="-verbose"/>
david_williamsad2097e2008-01-28 06:06:12 +0000273 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000274 value="-logger"/>
david_williamsad2097e2008-01-28 06:06:12 +0000275 <arg
david_williams8e4dc9c2008-07-06 08:08:58 +0000276 value="org.apache.tools.ant.DefaultLogger"/>
david_williams2f43da22009-07-22 04:25:24 +0000277 <arg
278 value="-file"/>
279 <arg
280 value="${testRoot}/test.xml"/>
281 <arg
282 value="${testTarget}"/>
283
284 <!-- make sure our forked env has a DISPLAY -->
david_williams403beae2007-12-09 02:10:40 +0000285 <env
286 key="DISPLAY"
david_williams8e4dc9c2008-07-06 08:08:58 +0000287 value="${env.DISPLAY}"/>
david_williams403beae2007-12-09 02:10:40 +0000288 <redirector
289 output="${testRoot}/results/fullOutput.txt"
david_williams8e4dc9c2008-07-06 08:08:58 +0000290 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2f43da22009-07-22 04:25:24 +0000291 <jvmarg
292 value="-Dbuild.home=${env.BUILD_HOME}"/>
293 <jvmarg
294 value="-DbuildDirectory=${buildDirectory}"/>
295 <jvmarg
296 value="-DbuildLabel=${buildLabel}"/>
297 <jvmarg
298 value="-DbaseLocation=${baseLocation}"/>
299 <jvmarg
300 value="-DtestRoot=${testRoot}"/>
301 <jvmarg
302 value="-DtestDir=${testRoot}"/>
303 <jvmarg
304 value="-Dperf.buildId=${buildType}${date}-${time}"/>
305 <jvmarg
306 value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
307 <jvmarg
308 value="-DbuildLabel=${buildLabel}"/>
309 <jvmarg
310 value="-Dplugin-path=${plugin-path}"/>
david_williams403beae2007-12-09 02:10:40 +0000311 </java>
david_williamsad2097e2008-01-28 06:06:12 +0000312 <echo
david_williams8e4dc9c2008-07-06 08:08:58 +0000313 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams403beae2007-12-09 02:10:40 +0000314 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000315 <target
316 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000317 <copy
318 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
319 overwrite="true"
320 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000321 <fileset
322 dir="${testRoot}/results">
323 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000324 name="*output.txt"/>
david_williams403beae2007-12-09 02:10:40 +0000325 </fileset>
326 </copy>
327 <copy
328 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
329 overwrite="true"
330 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000331 <fileset
332 dir="${testRoot}/results">
333 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000334 name="*error.txt"/>
david_williams403beae2007-12-09 02:10:40 +0000335 </fileset>
336 </copy>
337 <copy
338 file="${testRoot}/results/fullOutput.txt"
339 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
340 overwrite="true"
341 failonerror="false">
342 </copy>
343 <copy
344 file="${testRoot}/results/fullErrorLog.txt"
345 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
346 overwrite="true"
347 failonerror="false">
348 </copy>
david_williams403beae2007-12-09 02:10:40 +0000349 <copy
350 todir="${buildDirectory}/${buildLabel}/testResults/xml"
351 overwrite="true"
352 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000353 <fileset
354 dir="${testRoot}/results/xml">
355 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000356 name="*.xml"/>
david_williams403beae2007-12-09 02:10:40 +0000357 </fileset>
358 </copy>
359 <copy
360 todir="${buildDirectory}/${buildLabel}/testResults/html"
361 overwrite="true"
362 failonerror="false">
david_williamsad2097e2008-01-28 06:06:12 +0000363 <fileset
364 dir="${testRoot}/results/html">
365 <include
david_williams8e4dc9c2008-07-06 08:08:58 +0000366 name="*.html"/>
david_williams403beae2007-12-09 02:10:40 +0000367 </fileset>
368 </copy>
369 </target>
david_williamsad2097e2008-01-28 06:06:12 +0000370</project>