blob: 7cf6ea8125e841d7e54368229cb0de3ab852fc08 [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"
david_williams7e568c72010-09-12 09:04:15 +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
david_williams621a6f12010-09-26 08:34:59 +000021 level="info"
tle3bda23c2009-07-22 16:23:03 +000022 message="keyCfgFile: ${keyCfgFile}"/>
23 <property
24 file="${keyCfgFile}"/>
david_williams0f242892009-07-23 00:24:10 +000025
david_williams621a6f12010-09-26 08:34:59 +000026
david_williams0f242892009-07-23 00:24:10 +000027 <!--
28 typcially already set, but in case of standalone tests, may not
29 be
30 -->
31 <property
32 name="buildLabel"
33 value="${buildType}-${buildId}-${timestamp}"/>
34
david_williams42f9b242006-11-27 18:45:14 +000035
tle3bda23c2009-07-22 16:23:03 +000036 <!--
37 Steps to do after the build is done.
38 -->
tle170c7902008-10-02 03:15:49 +000039 <target
40 name="test">
41 <dirname
42 file="${ant.file}"
tle3bda23c2009-07-22 16:23:03 +000043 property="currentDirectory"/>
tle170c7902008-10-02 03:15:49 +000044 <ant
45 antfile="${ant.file}"
46 target="runTest"
tle3bda23c2009-07-22 16:23:03 +000047 dir="${currentDirectory}"/>
david_williams403beae2007-12-09 02:10:40 +000048 </target>
49
tle3bda23c2009-07-22 16:23:03 +000050 <!--
51 Steps to do to test the build results
52 -->
tle170c7902008-10-02 03:15:49 +000053 <target
54 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000055 <dirname
56 file="${ant.file}"
tle3bda23c2009-07-22 16:23:03 +000057 property="test.component.dir"/>
tle170c7902008-10-02 03:15:49 +000058 <ant
tle3bda23c2009-07-22 16:23:03 +000059 antfile="${wtp.builder.home}/scripts/build/label.xml"/>
david_williams0987a072007-02-20 18:27:24 +000060 <property
tle3bda23c2009-07-22 16:23:03 +000061 file="${buildDirectory}/label.properties"/>
tle170c7902008-10-02 03:15:49 +000062 <property
tle3bda23c2009-07-22 16:23:03 +000063 file="${wtp.builder.home}/build.properties"/>
tle170c7902008-10-02 03:15:49 +000064 <fail
65 message="testRoot must be set for this task"
tle3bda23c2009-07-22 16:23:03 +000066 unless="testRoot"/>
tle170c7902008-10-02 03:15:49 +000067 <mkdir
tle3bda23c2009-07-22 16:23:03 +000068 dir="${testRoot}"/>
ndai91f5c9b2006-03-12 13:56:45 +000069
tle3bda23c2009-07-22 16:23:03 +000070 <!-- if results already exist, delete them -->
tle170c7902008-10-02 03:15:49 +000071 <delete
72 dir="${testRoot}/results"
tle3bda23c2009-07-22 16:23:03 +000073 failOnError="false"/>
tle170c7902008-10-02 03:15:49 +000074 <mkdir
tle3bda23c2009-07-22 16:23:03 +000075 dir="${testRoot}/results"/>
tle170c7902008-10-02 03:15:49 +000076 <mkdir
tle3bda23c2009-07-22 16:23:03 +000077 dir="${testRoot}/results/consolelogs"/>
david_williamsec71cef2009-11-15 06:32:08 +000078
david_williams403beae2007-12-09 02:10:40 +000079 <copy
80 todir="${testRoot}"
81 overwrite="true">
tle170c7902008-10-02 03:15:49 +000082 <fileset
tle3bda23c2009-07-22 16:23:03 +000083 dir="${test.component.dir}/testScripts"/>
david_williams403beae2007-12-09 02:10:40 +000084 </copy>
david_williams403beae2007-12-09 02:10:40 +000085 <echo
tle3bda23c2009-07-22 16:23:03 +000086 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williams621a6f12010-09-26 08:34:59 +000087
88 <property
89 name="dependency.properties"
90 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
91 <available
92 file="${dependency.properties}"
93 property="dependency.properties.exists"/>
94 <fail
95 message="dependency file not found: ${dependency.properties}"
96 unless="dependency.properties.exists"/>
97 <property
98 name="test.dependency"
99 value="${buildDirectory}/maps/${env.RELENG}/${testdependencyFileLocation}"/>
100 <available
101 file="${test.dependency}"
102 property="test.dependency.exists"/>
103 <fail
104 message="test dependency file not found: ${test.dependency}"
105 unless="test.dependency.exists"/>
david_williams403beae2007-12-09 02:10:40 +0000106 <ant
david_williams621a6f12010-09-26 08:34:59 +0000107 antfile="${test.dependency}"
david_williams403beae2007-12-09 02:10:40 +0000108 target="get">
109 <property
110 name="dependency.properties"
david_williamsfab962c2009-10-28 04:18:20 +0000111 value="${buildDirectory}/maps/${env.RELENGDALI}/maps/dependencies.properties"/>
david_williams403beae2007-12-09 02:10:40 +0000112 <property
113 name="base.install.dir"
tle3bda23c2009-07-22 16:23:03 +0000114 value="${testRoot}"/>
david_williams403beae2007-12-09 02:10:40 +0000115 </ant>
tle170c7902008-10-02 03:15:49 +0000116 <antcall
tle3bda23c2009-07-22 16:23:03 +0000117 target="unzipTests"/>
tle170c7902008-10-02 03:15:49 +0000118 <antcall
119 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000120 </antcall>
tle170c7902008-10-02 03:15:49 +0000121 <antcall
122 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000123 </antcall>
david_williams403beae2007-12-09 02:10:40 +0000124 </target>
tle170c7902008-10-02 03:15:49 +0000125 <target
126 name="unzipTests">
tle3bda23c2009-07-22 16:23:03 +0000127 <!--
128 unzip the builds and junit tests we use 'unzip' here, so we
129 can continue on error, if desired. (such as if zip was not
130 created, due to other failures or options).
david_williams0987a072007-02-20 18:27:24 +0000131 -->
david_williams7e568c72010-09-12 09:04:15 +0000132 <echo
133 message="installing dali sdk"/>
david_williams0987a072007-02-20 18:27:24 +0000134 <exec
135 dir="${buildDirectory}/${buildLabel}"
136 executable="unzip"
tle170c7902008-10-02 03:15:49 +0000137 failonerror="true">
david_williams403beae2007-12-09 02:10:40 +0000138 <arg
tle3bda23c2009-07-22 16:23:03 +0000139 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams0987a072007-02-20 18:27:24 +0000140 </exec>
tle170c7902008-10-02 03:15:49 +0000141 <echo
david_williams7e568c72010-09-12 09:04:15 +0000142 message="installing dali tests"/>
tle170c7902008-10-02 03:15:49 +0000143 <exec
144 dir="${buildDirectory}/${buildLabel}"
145 executable="unzip"
146 failonerror="true">
147 <arg
tle3bda23c2009-07-22 16:23:03 +0000148 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
tle170c7902008-10-02 03:15:49 +0000149 </exec>
david_williams0987a072007-02-20 18:27:24 +0000150 </target>
tle3bda23c2009-07-22 16:23:03 +0000151 <!--
152 time out may need to be set/adjust for api or performance tests?
153 This testTimeLimit is the whole, overall limit on tests. There's
154 a shorter one for individual suites. some common values, of
155 milliseconds to more recognizable units:
156 14400000: 4 hours
157 7200000: 2 hours
158 3600000: 1 hour
159 1800000: 30 minutes
tle170c7902008-10-02 03:15:49 +0000160 600000: 10 minutes
161 -->
david_williams403beae2007-12-09 02:10:40 +0000162 <property
163 name="testTimeLimit"
tle3bda23c2009-07-22 16:23:03 +0000164 value="14400000"/>
david_williams403beae2007-12-09 02:10:40 +0000165 <property
166 name="testFailOnError"
tle3bda23c2009-07-22 16:23:03 +0000167 value="false"/>
david_williams403beae2007-12-09 02:10:40 +0000168 <target
169 name="runTestEclipse"
170 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000171 <property
172 name="test-vm"
tle3bda23c2009-07-22 16:23:03 +0000173 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams403beae2007-12-09 02:10:40 +0000174 <property
175 name="plugin-path"
tle3bda23c2009-07-22 16:23:03 +0000176 value="${testRoot}${dropinsFolder}/eclipse/plugins"/>
david_williams403beae2007-12-09 02:10:40 +0000177 <property
178 name="vmargs"
tle3bda23c2009-07-22 16:23:03 +0000179 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}"/>
180 <!--
181 set path to eclipse folder. If local folder, use '.';
182 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
183 -->
david_williams403beae2007-12-09 02:10:40 +0000184 <property
185 name="eclipse.home"
tle3bda23c2009-07-22 16:23:03 +0000186 value="${testRoot}"/>
tle170c7902008-10-02 03:15:49 +0000187 <echo
david_williams0f242892009-07-23 00:24:10 +0000188 message="testTarget: ${testTarget}"/>
189 <echo
190 message="plugin-path: ${plugin-path}"/>
191 <echo
tle3bda23c2009-07-22 16:23:03 +0000192 message="Running junits"/>
193 <!--
194 If there is not exactly one launcher in the stack, we'd best
195 fail fast, since we are not expecting that, and may indicate
196 an installation that would produce unpredictable results
197 -->
198 <!--
199 requires ant 1.7, and at this point, we're running 1.6 from
200 eclipse ... <condition property="expectedNumberOfLaunchers">
201 <resourcecount when="equal" count="1" > <fileset
202 dir="${testRoot}/eclipse/plugins"> <include
203 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
204 </resourcecount> </condition> <fail message="Did not find
205 expected number of launcher jars. Check installation."
206 unless="expectedNumberOfLaunchers" />
207 -->
208 <!--
david_williams621a6f12010-09-26 08:34:59 +0000209 Remember: using dash 'debug' for org.eclipse.ant.core.antRunner
tle3bda23c2009-07-22 16:23:03 +0000210 produces ant debug info to be output ... which is a TON of
david_williams621a6f12010-09-26 08:34:59 +0000211 stuff. Even 'verbose' is a bit too much.
david_williams403beae2007-12-09 02:10:40 +0000212 -->
david_williams621a6f12010-09-26 08:34:59 +0000213 <echo
214 message="eclipse.launcher: ${eclipse.launcher}"/>
david_williams403beae2007-12-09 02:10:40 +0000215 <java
216 taskname="unit-test-masterprocess"
217 fork="true"
218 resultProperty="wtpmasterjunitresult"
219 failonerror="false"
220 timeout="${testTimeLimit}"
221 dir="${testRoot}/eclipse"
tle3bda23c2009-07-22 16:23:03 +0000222 jvm="${env.JAVA_6_HOME}/bin/java"
david_williams403beae2007-12-09 02:10:40 +0000223 classname="org.eclipse.equinox.launcher.Main">
224 <classpath>
tle170c7902008-10-02 03:15:49 +0000225 <fileset
226 dir="${testRoot}/eclipse/plugins">
227 <include
tle3bda23c2009-07-22 16:23:03 +0000228 name="org.eclipse.equinox.launcher_*.jar"/>
david_williams403beae2007-12-09 02:10:40 +0000229 </fileset>
230 </classpath>
tle170c7902008-10-02 03:15:49 +0000231 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000232 value="-Xverify"/>
tle170c7902008-10-02 03:15:49 +0000233 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000234 value="-Dosgi.ws=${env.BASEWS}"/>
tle170c7902008-10-02 03:15:49 +0000235 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000236 value="-Dosgi.os=${env.BASEOS}"/>
tle170c7902008-10-02 03:15:49 +0000237 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000238 value="-Dosgi.arch=${env.BASEARCH}"/>
tle170c7902008-10-02 03:15:49 +0000239 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000240 value="-Dws=${env.BASEWS}"/>
tle170c7902008-10-02 03:15:49 +0000241 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000242 value="-Dos=${env.BASEOS}"/>
tle170c7902008-10-02 03:15:49 +0000243 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000244 value="-Darch=${env.BASEARCH}"/>
tle170c7902008-10-02 03:15:49 +0000245 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000246 value="-Dnoclean=true"/>
tle170c7902008-10-02 03:15:49 +0000247 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000248 value="-DbuildBranch=${buildBranch}"/>
tle170c7902008-10-02 03:15:49 +0000249 <jvmarg
david_williams7e568c72010-09-12 09:04:15 +0000250 value="-DbuildType=${buildType}"/>
251 <jvmarg
252 value="-DdependencyFileLocation=${dependencyFileLocation}"/>
253 <jvmarg
254 value="-DtestdependencyFileLocation=${testdependencyFileLocation}"/>
tle170c7902008-10-02 03:15:49 +0000255 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000256 value="-DbuildId=${buildId}"/>
tle170c7902008-10-02 03:15:49 +0000257 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000258 value="-Dprojectname=${projectname}"/>
david_williams249fae52008-05-02 03:41:42 +0000259 <jvmarg
tle3bda23c2009-07-22 16:23:03 +0000260 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
tleff165362009-07-27 17:11:33 +0000261 <arg
tle3bda23c2009-07-22 16:23:03 +0000262 value="-nosplash"/>
tle170c7902008-10-02 03:15:49 +0000263 <arg
tle3bda23c2009-07-22 16:23:03 +0000264 value="-consolelog"/>
tle170c7902008-10-02 03:15:49 +0000265 <arg
tle3bda23c2009-07-22 16:23:03 +0000266 value="-data"/>
tle170c7902008-10-02 03:15:49 +0000267 <arg
tle3bda23c2009-07-22 16:23:03 +0000268 value="${testRoot}/overallTestWorkspace"/>
tle170c7902008-10-02 03:15:49 +0000269 <arg
tle3bda23c2009-07-22 16:23:03 +0000270 value="-application"/>
tle170c7902008-10-02 03:15:49 +0000271 <arg
tle3bda23c2009-07-22 16:23:03 +0000272 value="org.eclipse.ant.core.antRunner"/>
david_williamse3faadc2009-07-23 02:27:12 +0000273<!--
tle170c7902008-10-02 03:15:49 +0000274 <arg
david_williams0f242892009-07-23 00:24:10 +0000275 value="-verbose"/>
david_williams7e568c72010-09-12 09:04:15 +0000276-->
tle170c7902008-10-02 03:15:49 +0000277 <arg
tle3bda23c2009-07-22 16:23:03 +0000278 value="-logger"/>
tle170c7902008-10-02 03:15:49 +0000279 <arg
tle3bda23c2009-07-22 16:23:03 +0000280 value="org.apache.tools.ant.DefaultLogger"/>
tleff165362009-07-27 17:11:33 +0000281 <arg
david_williams0f242892009-07-23 00:24:10 +0000282 value="-file"/>
283 <arg
284 value="${testRoot}/test.xml"/>
285 <arg
286 value="${testTarget}"/>
287
288 <!-- make sure our forked env has a DISPLAY -->
david_williams403beae2007-12-09 02:10:40 +0000289 <env
290 key="DISPLAY"
tle3bda23c2009-07-22 16:23:03 +0000291 value="${env.DISPLAY}"/>
david_williams403beae2007-12-09 02:10:40 +0000292 <redirector
293 output="${testRoot}/results/fullOutput.txt"
tle3bda23c2009-07-22 16:23:03 +0000294 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams0f242892009-07-23 00:24:10 +0000295 <jvmarg
296 value="-Dbuild.home=${env.BUILD_HOME}"/>
297 <jvmarg
298 value="-DbuildDirectory=${buildDirectory}"/>
299 <jvmarg
300 value="-DbuildLabel=${buildLabel}"/>
301 <jvmarg
302 value="-DbaseLocation=${baseLocation}"/>
303 <jvmarg
304 value="-DtestRoot=${testRoot}"/>
305 <jvmarg
306 value="-DtestDir=${testRoot}"/>
307 <jvmarg
david_williams0f242892009-07-23 00:24:10 +0000308 value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williams403beae2007-12-09 02:10:40 +0000309 </java>
tle170c7902008-10-02 03:15:49 +0000310 <echo
tle3bda23c2009-07-22 16:23:03 +0000311 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams403beae2007-12-09 02:10:40 +0000312 </target>
tle170c7902008-10-02 03:15:49 +0000313 <target
314 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000315 <copy
tle170c7902008-10-02 03:15:49 +0000316 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
317 overwrite="true"
318 failonerror="false">
319 <fileset
320 dir="${testRoot}/results">
321 <include
tle3bda23c2009-07-22 16:23:03 +0000322 name="*output.txt"/>
tle170c7902008-10-02 03:15:49 +0000323 </fileset>
324 </copy>
325 <copy
326 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
327 overwrite="true"
328 failonerror="false">
329 <fileset
330 dir="${testRoot}/results">
331 <include
tle3bda23c2009-07-22 16:23:03 +0000332 name="*error.txt"/>
tle170c7902008-10-02 03:15:49 +0000333 </fileset>
334 </copy>
335 <copy
336 file="${testRoot}/results/fullOutput.txt"
337 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
338 overwrite="true"
339 failonerror="false">
340 </copy>
341 <copy
342 file="${testRoot}/results/fullErrorLog.txt"
343 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
344 overwrite="true"
345 failonerror="false">
346 </copy>
347 <copy
348 todir="${buildDirectory}/${buildLabel}/testResults/xml"
349 overwrite="true"
350 failonerror="false">
351 <fileset
352 dir="${testRoot}/results/xml">
353 <include
tle3bda23c2009-07-22 16:23:03 +0000354 name="*.xml"/>
tle170c7902008-10-02 03:15:49 +0000355 </fileset>
356 </copy>
357 <copy
358 todir="${buildDirectory}/${buildLabel}/testResults/html"
359 overwrite="true"
360 failonerror="false">
361 <fileset
362 dir="${testRoot}/results/html">
363 <include
tle3bda23c2009-07-22 16:23:03 +0000364 name="*.html"/>
david_williams403beae2007-12-09 02:10:40 +0000365 </fileset>
366 </copy>
367 </target>
tle170c7902008-10-02 03:15:49 +0000368</project>