blob: 48eb16235cd1976b4b9aa5465ee14adc553f78eb [file] [log] [blame]
david_williams403beae2007-12-09 02:10:40 +00001<project
2 name="Build specific targets and properties"
tle170c7902008-10-02 03:15:49 +00003 default="runTest">
tle3bda23c2009-07-22 16:23:03 +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 -->
tle170c7902008-10-02 03:15:49 +000011 <property
tle3bda23c2009-07-22 16:23:03 +000012 environment="env"/>
david_williams0f242892009-07-23 00:24:10 +000013 <fail
14 message="testRoot must be set for this task"
tleff165362009-07-27 17:11:33 +000015 unless="testRoot" />
16 <!-- required to get proper value of dropinsFolder -->
tle3bda23c2009-07-22 16:23:03 +000017 <property
18 name="keyCfgFile"
19 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
20 <echo
21 level="debug"
22 message="keyCfgFile: ${keyCfgFile}"/>
23 <property
24 file="${keyCfgFile}"/>
david_williams0f242892009-07-23 00:24:10 +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
david_williams42f9b242006-11-27 18:45:14 +000038
tle3bda23c2009-07-22 16:23:03 +000039 <!--
40 Steps to do after the build is done.
41 -->
tle170c7902008-10-02 03:15:49 +000042 <target
43 name="test">
44 <dirname
45 file="${ant.file}"
tle3bda23c2009-07-22 16:23:03 +000046 property="currentDirectory"/>
tle170c7902008-10-02 03:15:49 +000047 <ant
48 antfile="${ant.file}"
49 target="runTest"
tle3bda23c2009-07-22 16:23:03 +000050 dir="${currentDirectory}"/>
david_williams403beae2007-12-09 02:10:40 +000051 </target>
52
tle3bda23c2009-07-22 16:23:03 +000053 <!--
54 Steps to do to test the build results
55 -->
tle170c7902008-10-02 03:15:49 +000056 <target
57 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000058 <dirname
59 file="${ant.file}"
tle3bda23c2009-07-22 16:23:03 +000060 property="test.component.dir"/>
tle170c7902008-10-02 03:15:49 +000061 <ant
tle3bda23c2009-07-22 16:23:03 +000062 antfile="${wtp.builder.home}/scripts/build/label.xml"/>
david_williams0987a072007-02-20 18:27:24 +000063 <property
tle3bda23c2009-07-22 16:23:03 +000064 file="${buildDirectory}/label.properties"/>
tle170c7902008-10-02 03:15:49 +000065 <property
tle3bda23c2009-07-22 16:23:03 +000066 file="${wtp.builder.home}/build.properties"/>
tle170c7902008-10-02 03:15:49 +000067 <fail
68 message="testRoot must be set for this task"
tle3bda23c2009-07-22 16:23:03 +000069 unless="testRoot"/>
tle170c7902008-10-02 03:15:49 +000070 <mkdir
tle3bda23c2009-07-22 16:23:03 +000071 dir="${testRoot}"/>
ndai91f5c9b2006-03-12 13:56:45 +000072
tle3bda23c2009-07-22 16:23:03 +000073 <!-- if results already exist, delete them -->
tle170c7902008-10-02 03:15:49 +000074 <delete
75 dir="${testRoot}/results"
tle3bda23c2009-07-22 16:23:03 +000076 failOnError="false"/>
tle170c7902008-10-02 03:15:49 +000077 <mkdir
tle3bda23c2009-07-22 16:23:03 +000078 dir="${testRoot}/results"/>
tle170c7902008-10-02 03:15:49 +000079 <mkdir
tle3bda23c2009-07-22 16:23:03 +000080 dir="${testRoot}/results/consolelogs"/>
tle170c7902008-10-02 03:15:49 +000081 <mkdir
tle3bda23c2009-07-22 16:23:03 +000082 dir="${testRoot}/results/consolelogs/metadata-logs"/>
tle170c7902008-10-02 03:15:49 +000083 <mkdir
tle3bda23c2009-07-22 16:23:03 +000084 dir="${testRoot}/results/consolelogs/configuration-logs"/>
david_williams403beae2007-12-09 02:10:40 +000085 <copy
86 todir="${testRoot}"
87 overwrite="true">
tle170c7902008-10-02 03:15:49 +000088 <fileset
tle3bda23c2009-07-22 16:23:03 +000089 dir="${test.component.dir}/testScripts"/>
david_williams403beae2007-12-09 02:10:40 +000090 </copy>
david_williams403beae2007-12-09 02:10:40 +000091 <echo
tle3bda23c2009-07-22 16:23:03 +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"
tleff165362009-07-27 17:11:33 +000098 value="${buildDirectory}/${env.RELENGDALI}/maps/dependencies.properties"/>
david_williams403beae2007-12-09 02:10:40 +000099 <property
100 name="base.install.dir"
tle3bda23c2009-07-22 16:23:03 +0000101 value="${testRoot}"/>
david_williams403beae2007-12-09 02:10:40 +0000102 </ant>
tle170c7902008-10-02 03:15:49 +0000103 <antcall
tle3bda23c2009-07-22 16:23:03 +0000104 target="unzipTests"/>
tle170c7902008-10-02 03:15:49 +0000105 <antcall
106 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000107 </antcall>
tle170c7902008-10-02 03:15:49 +0000108 <antcall
109 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000110 </antcall>
david_williams403beae2007-12-09 02:10:40 +0000111 </target>
tle170c7902008-10-02 03:15:49 +0000112 <target
113 name="unzipTests">
tle3bda23c2009-07-22 16:23:03 +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_williams0987a072007-02-20 18:27:24 +0000118 -->
tleff165362009-07-27 17:11:33 +0000119 <echo
120 message="installing dali sdk" />
david_williams0987a072007-02-20 18:27:24 +0000121 <exec
122 dir="${buildDirectory}/${buildLabel}"
123 executable="unzip"
tle170c7902008-10-02 03:15:49 +0000124 failonerror="true">
david_williams403beae2007-12-09 02:10:40 +0000125 <arg
tle3bda23c2009-07-22 16:23:03 +0000126 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams0987a072007-02-20 18:27:24 +0000127 </exec>
tle170c7902008-10-02 03:15:49 +0000128 <echo
129 message="installing dali tests" />
130 <exec
131 dir="${buildDirectory}/${buildLabel}"
132 executable="unzip"
133 failonerror="true">
134 <arg
tle3bda23c2009-07-22 16:23:03 +0000135 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
tle170c7902008-10-02 03:15:49 +0000136 </exec>
david_williams0987a072007-02-20 18:27:24 +0000137 </target>
tle3bda23c2009-07-22 16:23:03 +0000138 <!--
139 time out may need to be set/adjust for api or performance tests?
140 This testTimeLimit is the whole, overall limit on tests. There's
141 a shorter one for individual suites. some common values, of
142 milliseconds to more recognizable units:
143 14400000: 4 hours
144 7200000: 2 hours
145 3600000: 1 hour
146 1800000: 30 minutes
tle170c7902008-10-02 03:15:49 +0000147 600000: 10 minutes
148 -->
david_williams403beae2007-12-09 02:10:40 +0000149 <property
150 name="testTimeLimit"
tle3bda23c2009-07-22 16:23:03 +0000151 value="14400000"/>
david_williams403beae2007-12-09 02:10:40 +0000152 <property
153 name="testFailOnError"
tle3bda23c2009-07-22 16:23:03 +0000154 value="false"/>
david_williams403beae2007-12-09 02:10:40 +0000155 <target
156 name="runTestEclipse"
157 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000158 <property
159 name="test-vm"
tle3bda23c2009-07-22 16:23:03 +0000160 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams403beae2007-12-09 02:10:40 +0000161 <property
162 name="plugin-path"
tle3bda23c2009-07-22 16:23:03 +0000163 value="${testRoot}${dropinsFolder}/eclipse/plugins"/>
david_williams403beae2007-12-09 02:10:40 +0000164 <property
165 name="vmargs"
tle3bda23c2009-07-22 16:23:03 +0000166 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}"/>
167 <!--
168 set path to eclipse folder. If local folder, use '.';
169 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
170 -->
david_williams403beae2007-12-09 02:10:40 +0000171 <property
172 name="eclipse.home"
tle3bda23c2009-07-22 16:23:03 +0000173 value="${testRoot}"/>
tle170c7902008-10-02 03:15:49 +0000174 <echo
david_williams0f242892009-07-23 00:24:10 +0000175 message="testTarget: ${testTarget}"/>
176 <echo
177 message="plugin-path: ${plugin-path}"/>
178 <echo
tle3bda23c2009-07-22 16:23:03 +0000179 message="Running junits"/>
180 <!--
181 If there is not exactly one launcher in the stack, we'd best
182 fail fast, since we are not expecting that, and may indicate
183 an installation that would produce unpredictable results
184 -->
185 <!--
186 requires ant 1.7, and at this point, we're running 1.6 from
187 eclipse ... <condition property="expectedNumberOfLaunchers">
188 <resourcecount when="equal" count="1" > <fileset
189 dir="${testRoot}/eclipse/plugins"> <include
190 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
191 </resourcecount> </condition> <fail message="Did not find
192 expected number of launcher jars. Check installation."
193 unless="expectedNumberOfLaunchers" />
194 -->
195 <!--
196 Remember: using -debug for org.eclipse.ant.core.antRunner
197 produces ant debug info to be output ... which is a TON of
198 stuff
david_williams403beae2007-12-09 02:10:40 +0000199 -->
200 <java
201 taskname="unit-test-masterprocess"
202 fork="true"
203 resultProperty="wtpmasterjunitresult"
204 failonerror="false"
205 timeout="${testTimeLimit}"
206 dir="${testRoot}/eclipse"
tle3bda23c2009-07-22 16:23:03 +0000207 jvm="${env.JAVA_6_HOME}/bin/java"
david_williams403beae2007-12-09 02:10:40 +0000208 classname="org.eclipse.equinox.launcher.Main">
209 <classpath>
tle170c7902008-10-02 03:15:49 +0000210 <fileset
211 dir="${testRoot}/eclipse/plugins">
212 <include
tle3bda23c2009-07-22 16:23:03 +0000213 name="org.eclipse.equinox.launcher_*.jar"/>
david_williams403beae2007-12-09 02:10:40 +0000214 </fileset>
215 </classpath>
tle170c7902008-10-02 03:15:49 +0000216 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000217 value="-Xverify"/>
tle170c7902008-10-02 03:15:49 +0000218 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000219 value="-Dosgi.ws=${env.BASEWS}"/>
tle170c7902008-10-02 03:15:49 +0000220 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000221 value="-Dosgi.os=${env.BASEOS}"/>
tle170c7902008-10-02 03:15:49 +0000222 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000223 value="-Dosgi.arch=${env.BASEARCH}"/>
tle170c7902008-10-02 03:15:49 +0000224 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000225 value="-Dws=${env.BASEWS}"/>
tle170c7902008-10-02 03:15:49 +0000226 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000227 value="-Dos=${env.BASEOS}"/>
tle170c7902008-10-02 03:15:49 +0000228 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000229 value="-Darch=${env.BASEARCH}"/>
tle170c7902008-10-02 03:15:49 +0000230 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000231 value="-Dnoclean=true"/>
tle170c7902008-10-02 03:15:49 +0000232 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000233 value="-DbuildBranch=${buildBranch}"/>
tle170c7902008-10-02 03:15:49 +0000234 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000235 value="-DbuildType=${buildType}"/>
tle170c7902008-10-02 03:15:49 +0000236 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000237 value="-DbuildId=${buildId}"/>
tle170c7902008-10-02 03:15:49 +0000238 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000239 value="-Dprojectname=${projectname}"/>
david_williams249fae52008-05-02 03:41:42 +0000240 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000241 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
tleff165362009-07-27 17:11:33 +0000242 <arg
tle3bda23c2009-07-22 16:23:03 +0000243 value="-nosplash"/>
tle170c7902008-10-02 03:15:49 +0000244 <arg
tle3bda23c2009-07-22 16:23:03 +0000245 value="-consolelog"/>
tle170c7902008-10-02 03:15:49 +0000246 <arg
tle3bda23c2009-07-22 16:23:03 +0000247 value="-data"/>
tle170c7902008-10-02 03:15:49 +0000248 <arg
tle3bda23c2009-07-22 16:23:03 +0000249 value="${testRoot}/overallTestWorkspace"/>
tle170c7902008-10-02 03:15:49 +0000250 <arg
tle3bda23c2009-07-22 16:23:03 +0000251 value="-application"/>
tle170c7902008-10-02 03:15:49 +0000252 <arg
tle3bda23c2009-07-22 16:23:03 +0000253 value="org.eclipse.ant.core.antRunner"/>
david_williamse3faadc2009-07-23 02:27:12 +0000254<!--
tle170c7902008-10-02 03:15:49 +0000255 <arg
david_williams0f242892009-07-23 00:24:10 +0000256 value="-verbose"/>
david_williamse3faadc2009-07-23 02:27:12 +0000257-->
tle170c7902008-10-02 03:15:49 +0000258 <arg
tle3bda23c2009-07-22 16:23:03 +0000259 value="-logger"/>
tle170c7902008-10-02 03:15:49 +0000260 <arg
tle3bda23c2009-07-22 16:23:03 +0000261 value="org.apache.tools.ant.DefaultLogger"/>
tleff165362009-07-27 17:11:33 +0000262 <arg
david_williams0f242892009-07-23 00:24:10 +0000263 value="-file"/>
264 <arg
265 value="${testRoot}/test.xml"/>
266 <arg
267 value="${testTarget}"/>
268
269 <!-- make sure our forked env has a DISPLAY -->
david_williams403beae2007-12-09 02:10:40 +0000270 <env
271 key="DISPLAY"
tle3bda23c2009-07-22 16:23:03 +0000272 value="${env.DISPLAY}"/>
david_williams403beae2007-12-09 02:10:40 +0000273 <redirector
274 output="${testRoot}/results/fullOutput.txt"
tle3bda23c2009-07-22 16:23:03 +0000275 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams0f242892009-07-23 00:24:10 +0000276 <jvmarg
277 value="-Dbuild.home=${env.BUILD_HOME}"/>
278 <jvmarg
279 value="-DbuildDirectory=${buildDirectory}"/>
280 <jvmarg
281 value="-DbuildLabel=${buildLabel}"/>
282 <jvmarg
283 value="-DbaseLocation=${baseLocation}"/>
284 <jvmarg
285 value="-DtestRoot=${testRoot}"/>
286 <jvmarg
287 value="-DtestDir=${testRoot}"/>
288 <jvmarg
289 value="-Dperf.buildId=${buildType}${date}-${time}"/>
290 <jvmarg
291 value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
292 <jvmarg
293 value="-DbuildLabel=${buildLabel}"/>
294 <jvmarg
295 value="-Dplugin-path=${plugin-path}"/>
david_williams403beae2007-12-09 02:10:40 +0000296 </java>
tle170c7902008-10-02 03:15:49 +0000297 <echo
tle3bda23c2009-07-22 16:23:03 +0000298 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams403beae2007-12-09 02:10:40 +0000299 </target>
tle170c7902008-10-02 03:15:49 +0000300 <target
301 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000302 <copy
tle170c7902008-10-02 03:15:49 +0000303 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
304 overwrite="true"
305 failonerror="false">
306 <fileset
307 dir="${testRoot}/results">
308 <include
tle3bda23c2009-07-22 16:23:03 +0000309 name="*output.txt"/>
tle170c7902008-10-02 03:15:49 +0000310 </fileset>
311 </copy>
312 <copy
313 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
314 overwrite="true"
315 failonerror="false">
316 <fileset
317 dir="${testRoot}/results">
318 <include
tle3bda23c2009-07-22 16:23:03 +0000319 name="*error.txt"/>
tle170c7902008-10-02 03:15:49 +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>
334 <copy
335 todir="${buildDirectory}/${buildLabel}/testResults/xml"
336 overwrite="true"
337 failonerror="false">
338 <fileset
339 dir="${testRoot}/results/xml">
340 <include
tle3bda23c2009-07-22 16:23:03 +0000341 name="*.xml"/>
tle170c7902008-10-02 03:15:49 +0000342 </fileset>
343 </copy>
344 <copy
345 todir="${buildDirectory}/${buildLabel}/testResults/html"
346 overwrite="true"
347 failonerror="false">
348 <fileset
349 dir="${testRoot}/results/html">
350 <include
tle3bda23c2009-07-22 16:23:03 +0000351 name="*.html"/>
david_williams403beae2007-12-09 02:10:40 +0000352 </fileset>
353 </copy>
354 </target>
tle170c7902008-10-02 03:15:49 +0000355</project>