blob: 32d662efa2ee8d6f57239ff61a914a5ec14244e4 [file] [log] [blame]
david_williams88cbf012009-01-12 21:53:05 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
david_williams0902bf82009-01-14 05:14:11 +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_williams88cbf012009-01-12 21:53:05 +000011 <property
david_williams0902bf82009-01-14 05:14:11 +000012 environment="env"/>
david_williams88cbf012009-01-12 21:53:05 +000013 <fail
14 message="testRoot must be set for this task"
david_williams0902bf82009-01-14 05:14:11 +000015 unless="testRoot"/>
16 <!-- required to get proper value of dropinsFolder -->
17 <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_williams88cbf012009-01-12 21:53:05 +000025
david_williams0902bf82009-01-14 05:14:11 +000026
27 <!--
david_williamsdb9eed92009-11-18 20:03:49 +000028 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
35
36 <!--
david_williams88cbf012009-01-12 21:53:05 +000037 Steps to do after the build is done.
38 -->
39 <target
40 name="test">
41 <dirname
42 file="${ant.file}"
david_williams0902bf82009-01-14 05:14:11 +000043 property="currentDirectory"/>
david_williams88cbf012009-01-12 21:53:05 +000044 <ant
45 antfile="${ant.file}"
46 target="runTest"
david_williams0902bf82009-01-14 05:14:11 +000047 dir="${currentDirectory}"/>
david_williams88cbf012009-01-12 21:53:05 +000048 </target>
49
david_williams0902bf82009-01-14 05:14:11 +000050 <!--
david_williams88cbf012009-01-12 21:53:05 +000051 Steps to do to test the build results
52 -->
53 <target
54 name="runTest">
55 <dirname
56 file="${ant.file}"
david_williams0902bf82009-01-14 05:14:11 +000057 property="test.component.dir"/>
david_williams88cbf012009-01-12 21:53:05 +000058 <ant
david_williams0902bf82009-01-14 05:14:11 +000059 antfile="${wtp.builder.home}/scripts/build/label.xml"/>
david_williams88cbf012009-01-12 21:53:05 +000060 <property
david_williams0902bf82009-01-14 05:14:11 +000061 file="${buildDirectory}/label.properties"/>
david_williams88cbf012009-01-12 21:53:05 +000062 <property
david_williams0902bf82009-01-14 05:14:11 +000063 file="${wtp.builder.home}/build.properties"/>
david_williams88cbf012009-01-12 21:53:05 +000064 <fail
65 message="testRoot must be set for this task"
david_williams0902bf82009-01-14 05:14:11 +000066 unless="testRoot"/>
david_williams88cbf012009-01-12 21:53:05 +000067 <mkdir
david_williams0902bf82009-01-14 05:14:11 +000068 dir="${testRoot}"/>
david_williams88cbf012009-01-12 21:53:05 +000069
david_williams0902bf82009-01-14 05:14:11 +000070 <!-- if results already exist, delete them -->
david_williams88cbf012009-01-12 21:53:05 +000071 <delete
72 dir="${testRoot}/results"
david_williams0902bf82009-01-14 05:14:11 +000073 failOnError="false"/>
david_williams88cbf012009-01-12 21:53:05 +000074 <mkdir
david_williams0902bf82009-01-14 05:14:11 +000075 dir="${testRoot}/results"/>
david_williams88cbf012009-01-12 21:53:05 +000076 <mkdir
david_williams0902bf82009-01-14 05:14:11 +000077 dir="${testRoot}/results/consolelogs"/>
david_williams88cbf012009-01-12 21:53:05 +000078 <copy
79 todir="${testRoot}"
80 overwrite="true">
81 <fileset
david_williams0902bf82009-01-14 05:14:11 +000082 dir="${test.component.dir}/testScripts"/>
david_williams88cbf012009-01-12 21:53:05 +000083 </copy>
84 <echo
david_williams0902bf82009-01-14 05:14:11 +000085 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williams88cbf012009-01-12 21:53:05 +000086 <ant
87 antfile="${test.component.dir}/testdependency.xml"
88 target="get">
89 <property
90 name="dependency.properties"
david_williamscecc5a92009-09-30 03:17:50 +000091 value="${buildDirectory}/maps/${env.RELENG}${env.DEP_DIR}/maps/dependencies.properties"/>
david_williams88cbf012009-01-12 21:53:05 +000092 <property
93 name="base.install.dir"
david_williams0902bf82009-01-14 05:14:11 +000094 value="${testRoot}"/>
david_williams88cbf012009-01-12 21:53:05 +000095 </ant>
96 <antcall
david_williams0902bf82009-01-14 05:14:11 +000097 target="unzipTests"/>
david_williams88cbf012009-01-12 21:53:05 +000098 <antcall
99 target="runTestEclipse">
100 <param
101 name="testTarget"
david_williams0902bf82009-01-14 05:14:11 +0000102 value="all"/>
david_williams88cbf012009-01-12 21:53:05 +0000103 </antcall>
104 <antcall
105 target="postRunTestEclipse">
106 <param
107 name="testTarget"
david_williams0902bf82009-01-14 05:14:11 +0000108 value="all"/>
david_williams88cbf012009-01-12 21:53:05 +0000109 </antcall>
110 </target>
111 <target
112 name="unzipTests">
david_williams0902bf82009-01-14 05:14:11 +0000113 <!--
114 unzip the builds and junit tests we use 'unzip' here, so we
115 can continue on error, if desired. (such as if zip was not
116 created, due to other failures or options).
david_williams88cbf012009-01-12 21:53:05 +0000117 -->
118 <echo
david_williams0902bf82009-01-14 05:14:11 +0000119 message="installing sdk"/>
david_williams88cbf012009-01-12 21:53:05 +0000120 <exec
121 dir="${buildDirectory}/${buildLabel}"
122 executable="unzip"
123 failonerror="true">
124 <arg
david_williams0902bf82009-01-14 05:14:11 +0000125 line="-o -qq @zipprefix@-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams88cbf012009-01-12 21:53:05 +0000126 </exec>
127 <echo
david_williams0902bf82009-01-14 05:14:11 +0000128 message="installing tests"/>
david_williams88cbf012009-01-12 21:53:05 +0000129 <exec
130 dir="${buildDirectory}/${buildLabel}"
131 executable="unzip"
david_williams9dd85942009-09-30 07:13:56 +0000132 failonerror="false">
david_williams88cbf012009-01-12 21:53:05 +0000133 <arg
david_williams0902bf82009-01-14 05:14:11 +0000134 line="-o -qq @zipprefix@-tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams88cbf012009-01-12 21:53:05 +0000135 </exec>
136 </target>
david_williams0902bf82009-01-14 05:14:11 +0000137 <!--
138 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
140 a shorter one for individual suites. some common values, of
141 milliseconds to more recognizable units: 7200000: 2 hours
142 3600000: 1 hour 1800000: 30 minutes 600000: 10 minutes
david_williams88cbf012009-01-12 21:53:05 +0000143 -->
144 <property
145 name="testTimeLimit"
david_williams0902bf82009-01-14 05:14:11 +0000146 value="7200000"/>
david_williams88cbf012009-01-12 21:53:05 +0000147 <property
148 name="testFailOnError"
david_williams0902bf82009-01-14 05:14:11 +0000149 value="false"/>
david_williams88cbf012009-01-12 21:53:05 +0000150 <target
151 name="runTestEclipse"
152 description="Run our JUnit's within an instance of antRunner">
153 <property
154 name="test-vm"
david_williams0902bf82009-01-14 05:14:11 +0000155 value="${env.JAVA_6_HOME}/bin/java"/>
david_williams7f87e3e2009-11-19 03:47:11 +0000156
david_williams36839e52009-11-23 02:33:12 +0000157 <!--
david_williams0902bf82009-01-14 05:14:11 +0000158 set path to eclipse folder. If local folder, use '.';
159 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
160 -->
david_williams88cbf012009-01-12 21:53:05 +0000161 <property
162 name="eclipse.home"
david_williams0902bf82009-01-14 05:14:11 +0000163 value="${testRoot}"/>
david_williams88cbf012009-01-12 21:53:05 +0000164 <echo
david_williams0902bf82009-01-14 05:14:11 +0000165 message="Running junits"/>
166 <!--
167 Remember: using -debug for org.eclipse.ant.core.antRunner
168 produces ant debug info to be output ... which is a TON of
169 stuff
david_williams88cbf012009-01-12 21:53:05 +0000170 -->
171 <echo
david_williams0902bf82009-01-14 05:14:11 +0000172 message="eclipse.launcher: ${eclipse.launcher}"/>
david_williams88cbf012009-01-12 21:53:05 +0000173 <java
174 taskname="unit-test-masterprocess"
175 fork="true"
176 resultProperty="wtpmasterjunitresult"
177 failonerror="false"
178 timeout="${testTimeLimit}"
179 dir="${testRoot}/eclipse"
180 jvm="${env.JAVA_6_HOME}/bin/java"
181 classname="org.eclipse.equinox.launcher.Main">
182 <classpath>
183 <fileset
184 dir="${testRoot}/eclipse/plugins">
185 <include
david_williams0902bf82009-01-14 05:14:11 +0000186 name="org.eclipse.equinox.launcher_*.jar"/>
david_williams88cbf012009-01-12 21:53:05 +0000187 </fileset>
188 </classpath>
189 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000190 value="-Xmx512m"/>
david_williams88cbf012009-01-12 21:53:05 +0000191 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000192 value="-Dosgi.ws=${env.BASEWS}"/>
david_williams88cbf012009-01-12 21:53:05 +0000193 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000194 value="-Dosgi.os=${env.BASEOS}"/>
david_williams88cbf012009-01-12 21:53:05 +0000195 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000196 value="-Dosgi.arch=${env.BASEARCH}"/>
david_williams88cbf012009-01-12 21:53:05 +0000197 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000198 value="-Dws=${env.BASEWS}"/>
david_williams88cbf012009-01-12 21:53:05 +0000199 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000200 value="-Dos=${env.BASEOS}"/>
david_williams88cbf012009-01-12 21:53:05 +0000201 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000202 value="-Darch=${env.BASEARCH}"/>
david_williams88cbf012009-01-12 21:53:05 +0000203 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000204 value="-Dnoclean=true"/>
david_williams88cbf012009-01-12 21:53:05 +0000205 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000206 value="-DbuildBranch=${buildBranch}"/>
david_williams88cbf012009-01-12 21:53:05 +0000207 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000208 value="-DbuildType=${buildType}"/>
david_williams88cbf012009-01-12 21:53:05 +0000209 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000210 value="-DbuildId=${buildId}"/>
david_williams88cbf012009-01-12 21:53:05 +0000211 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000212 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
david_williams88cbf012009-01-12 21:53:05 +0000213 <jvmarg
david_williams0902bf82009-01-14 05:14:11 +0000214 value="-Dprojectname=${projectname}"/>
david_williams88cbf012009-01-12 21:53:05 +0000215 <arg
david_williams0902bf82009-01-14 05:14:11 +0000216 value="-nosplash"/>
david_williams88cbf012009-01-12 21:53:05 +0000217 <arg
david_williams0902bf82009-01-14 05:14:11 +0000218 value="-consolelog"/>
david_williams88cbf012009-01-12 21:53:05 +0000219 <arg
david_williams0902bf82009-01-14 05:14:11 +0000220 value="-data"/>
david_williams88cbf012009-01-12 21:53:05 +0000221 <arg
david_williams0902bf82009-01-14 05:14:11 +0000222 value="${testRoot}/overallTestWorkspace"/>
david_williams88cbf012009-01-12 21:53:05 +0000223 <arg
david_williams0902bf82009-01-14 05:14:11 +0000224 value="-application"/>
david_williams88cbf012009-01-12 21:53:05 +0000225 <arg
david_williams0902bf82009-01-14 05:14:11 +0000226 value="org.eclipse.ant.core.antRunner"/>
david_williams88cbf012009-01-12 21:53:05 +0000227 <arg
david_williams0902bf82009-01-14 05:14:11 +0000228 value="-file"/>
david_williams88cbf012009-01-12 21:53:05 +0000229 <arg
david_williams0902bf82009-01-14 05:14:11 +0000230 value="${testRoot}/test.xml"/>
david_williams88cbf012009-01-12 21:53:05 +0000231 <arg
david_williams0902bf82009-01-14 05:14:11 +0000232 value="-logger"/>
david_williams88cbf012009-01-12 21:53:05 +0000233 <arg
david_williams0902bf82009-01-14 05:14:11 +0000234 value="org.apache.tools.ant.DefaultLogger"/>
david_williams88cbf012009-01-12 21:53:05 +0000235 <env
236 key="DISPLAY"
david_williams0902bf82009-01-14 05:14:11 +0000237 value="${env.DISPLAY}"/>
david_williams88cbf012009-01-12 21:53:05 +0000238 <redirector
239 output="${testRoot}/results/fullOutput.txt"
david_williams0902bf82009-01-14 05:14:11 +0000240 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams88cbf012009-01-12 21:53:05 +0000241 <sysproperty
242 key="build.home"
david_williams0902bf82009-01-14 05:14:11 +0000243 value="${env.BUILD_HOME}"/>
david_williams88cbf012009-01-12 21:53:05 +0000244 <sysproperty
245 key="buildDirectory"
david_williams0902bf82009-01-14 05:14:11 +0000246 value="${buildDirectory}"/>
david_williams88cbf012009-01-12 21:53:05 +0000247 <sysproperty
248 key="buildLabel"
david_williams0902bf82009-01-14 05:14:11 +0000249 value="${buildLabel}"/>
david_williams88cbf012009-01-12 21:53:05 +0000250 <sysproperty
251 key="baseLocation"
david_williams0902bf82009-01-14 05:14:11 +0000252 value="${baseLocation}"/>
david_williams88cbf012009-01-12 21:53:05 +0000253 <sysproperty
254 key="testRoot"
david_williams0902bf82009-01-14 05:14:11 +0000255 value="${testRoot}"/>
david_williams88cbf012009-01-12 21:53:05 +0000256 <sysproperty
257 key="testDir"
david_williams0902bf82009-01-14 05:14:11 +0000258 value="${testRoot}"/>
david_williams88cbf012009-01-12 21:53:05 +0000259 <sysproperty
260 key="perf.buildId"
david_williams0902bf82009-01-14 05:14:11 +0000261 value="${buildType}${date}-${time}"/>
david_williams88cbf012009-01-12 21:53:05 +0000262 <sysproperty
263 key="eclipseBuilderDirectory"
david_williams0902bf82009-01-14 05:14:11 +0000264 value="${pde.builder.path}"/>
david_williams88cbf012009-01-12 21:53:05 +0000265 <sysproperty
266 key="buildLabel"
david_williams0902bf82009-01-14 05:14:11 +0000267 value="${buildLabel}"/>
david_williams88cbf012009-01-12 21:53:05 +0000268 </java>
269 <echo
david_williams0902bf82009-01-14 05:14:11 +0000270 message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams88cbf012009-01-12 21:53:05 +0000271 </target>
272 <target
273 name="postRunTestEclipse">
274 <copy
275 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
276 overwrite="true"
277 failonerror="false">
278 <fileset
279 dir="${testRoot}/results">
280 <include
david_williams0902bf82009-01-14 05:14:11 +0000281 name="*output.txt"/>
david_williams88cbf012009-01-12 21:53:05 +0000282 </fileset>
283 </copy>
284 <copy
285 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
286 overwrite="true"
287 failonerror="false">
288 <fileset
289 dir="${testRoot}/results">
290 <include
david_williams0902bf82009-01-14 05:14:11 +0000291 name="*error.txt"/>
david_williams88cbf012009-01-12 21:53:05 +0000292 </fileset>
293 </copy>
294 <copy
295 file="${testRoot}/results/fullOutput.txt"
296 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
297 overwrite="true"
298 failonerror="false">
299 </copy>
300 <copy
301 file="${testRoot}/results/fullErrorLog.txt"
302 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
303 overwrite="true"
304 failonerror="false">
305 </copy>
306 <copy
307 todir="${buildDirectory}/${buildLabel}/testResults/xml"
308 overwrite="true"
309 failonerror="false">
310 <fileset
311 dir="${testRoot}/results/xml">
312 <include
david_williams0902bf82009-01-14 05:14:11 +0000313 name="*.xml"/>
david_williams88cbf012009-01-12 21:53:05 +0000314 </fileset>
315 </copy>
316 <copy
317 todir="${buildDirectory}/${buildLabel}/testResults/html"
318 overwrite="true"
319 failonerror="false">
320 <fileset
321 dir="${testRoot}/results/html">
322 <include
david_williams0902bf82009-01-14 05:14:11 +0000323 name="*.html"/>
david_williams88cbf012009-01-12 21:53:05 +0000324 </fileset>
325 </copy>
326 </target>
327</project>