blob: 851ba9a8cf0b7b5c2ea55fd0fd9a25f7556859c5 [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">
ndai91f5c9b2006-03-12 13:56:45 +00004
tle170c7902008-10-02 03:15:49 +00005 <!-- Note to be cross-platform, "environment variables" are only appropriate for
6 some variables, e.g. ones we set, since properties are case sensitive, even if
7 the environment variables on your operating system are not, e.g. it will
david_williams42f9b242006-11-27 18:45:14 +00008 be ${env.Path} not ${env.PATH} on Windows -->
tle170c7902008-10-02 03:15:49 +00009 <property
10 environment="env" />
11 <fail
12 message="testRoot must be set for this task"
13 unless="testRoot" />
14 <!-- required to get proper value of dropinsFolder -->
15 <property name="keyCfgFile" value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg" />
16 <echo
17 level="debug"
18 message="keyCfgFile: ${keyCfgFile}" />
19 <property file="${keyCfgFile}" />
20
david_williams42f9b242006-11-27 18:45:14 +000021
tle170c7902008-10-02 03:15:49 +000022 <!--
23 Steps to do after the build is done.
24 -->
25 <target
26 name="test">
27 <dirname
28 file="${ant.file}"
29 property="currentDirectory" />
30 <ant
31 antfile="${ant.file}"
32 target="runTest"
33 dir="${currentDirectory}" />
david_williams403beae2007-12-09 02:10:40 +000034 </target>
35
tle170c7902008-10-02 03:15:49 +000036 <!--
37 Steps to do to test the build results
38 -->
39 <target
40 name="runTest">
david_williams403beae2007-12-09 02:10:40 +000041 <dirname
42 file="${ant.file}"
43 property="test.component.dir" />
tle170c7902008-10-02 03:15:49 +000044 <ant
45 antfile="${wtp.builder.home}/scripts/build/label.xml" />
david_williams0987a072007-02-20 18:27:24 +000046 <property
tle170c7902008-10-02 03:15:49 +000047 file="${buildDirectory}/label.properties" />
48 <property
49 file="${wtp.builder.home}/build.properties" />
50 <fail
51 message="testRoot must be set for this task"
52 unless="testRoot" />
53 <mkdir
54 dir="${testRoot}" />
ndai91f5c9b2006-03-12 13:56:45 +000055
tle170c7902008-10-02 03:15:49 +000056 <!-- if results already exist, delete them -->
57 <delete
58 dir="${testRoot}/results"
59 failOnError="false" />
60 <mkdir
61 dir="${testRoot}/results" />
62 <mkdir
63 dir="${testRoot}/results/consolelogs" />
64 <mkdir
65 dir="${testRoot}/results/consolelogs/metadata-logs" />
66 <mkdir
67 dir="${testRoot}/results/consolelogs/configuration-logs" />
david_williams403beae2007-12-09 02:10:40 +000068 <copy
69 todir="${testRoot}"
70 overwrite="true">
tle170c7902008-10-02 03:15:49 +000071 <fileset
72 dir="${test.component.dir}/testScripts" />
david_williams403beae2007-12-09 02:10:40 +000073 </copy>
david_williams403beae2007-12-09 02:10:40 +000074 <echo
75 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
76 <ant
77 antfile="${test.component.dir}/testdependency.xml"
78 target="get">
79 <property
80 name="dependency.properties"
david_williamsae24cb12008-10-04 23:39:52 +000081 value="${buildDirectory}/maps/${env.RELENGDALI}/maps/dependencies.properties" />
david_williams403beae2007-12-09 02:10:40 +000082 <property
83 name="base.install.dir"
84 value="${testRoot}" />
85 </ant>
tle170c7902008-10-02 03:15:49 +000086 <antcall
87 target="unzipTests" />
88 <antcall
89 target="runTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000090 <param
91 name="testTarget"
92 value="all" />
93 </antcall>
tle170c7902008-10-02 03:15:49 +000094 <antcall
95 target="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +000096 <param
97 name="testTarget"
98 value="all" />
99 </antcall>
david_williams403beae2007-12-09 02:10:40 +0000100 </target>
tle170c7902008-10-02 03:15:49 +0000101 <target
102 name="unzipTests">
ndai91f5c9b2006-03-12 13:56:45 +0000103
tle170c7902008-10-02 03:15:49 +0000104 <!--unzip the builds and junit tests
105 we use 'unzip' here, so we can continue on error, if desired.
david_williams403beae2007-12-09 02:10:40 +0000106 (such as if zip was not created, due to other failures or options).
david_williams0987a072007-02-20 18:27:24 +0000107 -->
tle170c7902008-10-02 03:15:49 +0000108 <echo
109 message="installing dali sdk" />
david_williams0987a072007-02-20 18:27:24 +0000110 <exec
111 dir="${buildDirectory}/${buildLabel}"
112 executable="unzip"
tle170c7902008-10-02 03:15:49 +0000113 failonerror="true">
david_williams403beae2007-12-09 02:10:40 +0000114 <arg
tle170c7902008-10-02 03:15:49 +0000115 line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
david_williams0987a072007-02-20 18:27:24 +0000116 </exec>
tle170c7902008-10-02 03:15:49 +0000117 <echo
118 message="installing dali tests" />
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="true">
123 <arg
124 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
125 </exec>
david_williams0987a072007-02-20 18:27:24 +0000126 </target>
david_williams0987a072007-02-20 18:27:24 +0000127
tle170c7902008-10-02 03:15:49 +0000128 <!-- time out may need to be set/adjust for api or performance tests?
129 This testTimeLimit is the whole, overall limit on tests. There's a shorter
130 one for individual suites.
131
132 some common values, of milliseconds to more recognizable units:
133 7200000: 2 hours
134 3600000: 1 hour
135 1800000: 30 minutes
136 600000: 10 minutes
137 -->
david_williams403beae2007-12-09 02:10:40 +0000138 <property
139 name="testTimeLimit"
140 value="7200000" />
141 <property
142 name="testFailOnError"
143 value="false" />
david_williams403beae2007-12-09 02:10:40 +0000144 <target
145 name="runTestEclipse"
146 description="Run our JUnit's within an instance of antRunner">
david_williams403beae2007-12-09 02:10:40 +0000147 <property
148 name="test-vm"
tle170c7902008-10-02 03:15:49 +0000149 value="${env.JAVA_6_HOME}/bin/java" />
david_williams403beae2007-12-09 02:10:40 +0000150 <property
151 name="plugin-path"
tle170c7902008-10-02 03:15:49 +0000152 value="${testRoot}${dropinsFolder}/eclipse/plugins" />
david_williams403beae2007-12-09 02:10:40 +0000153 <property
154 name="vmargs"
david_williams3ac3b032008-09-23 05:23:34 +0000155 value="-Xmx512m -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_williamseb49d082007-05-01 03:03:15 +0000156
157
tle170c7902008-10-02 03:15:49 +0000158 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
david_williams403beae2007-12-09 02:10:40 +0000159 <property
160 name="eclipse.home"
161 value="${testRoot}" />
tle170c7902008-10-02 03:15:49 +0000162 <echo
163 message="Running junits" />
david_williamseb49d082007-05-01 03:03:15 +0000164
tle170c7902008-10-02 03:15:49 +0000165 <!--
david_williams403beae2007-12-09 02:10:40 +0000166 Remember: using -debug for org.eclipse.ant.core.antRunner
167 produces ant debug info to be output ... which is a TON of stuff
168 -->
tle170c7902008-10-02 03:15:49 +0000169 <echo
170 message="eclipse.launcher: ${eclipse.launcher}" />
david_williams403beae2007-12-09 02:10:40 +0000171 <java
172 taskname="unit-test-masterprocess"
173 fork="true"
174 resultProperty="wtpmasterjunitresult"
175 failonerror="false"
176 timeout="${testTimeLimit}"
177 dir="${testRoot}/eclipse"
tle170c7902008-10-02 03:15:49 +0000178 jvm="${env.JAVA_6_HOME}/bin/java"
david_williams403beae2007-12-09 02:10:40 +0000179 classname="org.eclipse.equinox.launcher.Main">
180 <classpath>
tle170c7902008-10-02 03:15:49 +0000181 <fileset
182 dir="${testRoot}/eclipse/plugins">
183 <include
184 name="org.eclipse.equinox.launcher_*.jar" />
david_williams403beae2007-12-09 02:10:40 +0000185 </fileset>
186 </classpath>
tle170c7902008-10-02 03:15:49 +0000187 <jvmarg
188 value="-Xmx512m" />
189 <jvmarg
190 value="-Dosgi.ws=${env.BASEWS}" />
191 <jvmarg
192 value="-Dosgi.os=${env.BASEOS}" />
193 <jvmarg
194 value="-Dosgi.arch=${env.BASEARCH}" />
195 <jvmarg
196 value="-Dws=${env.BASEWS}" />
197 <jvmarg
198 value="-Dos=${env.BASEOS}" />
199 <jvmarg
200 value="-Darch=${env.BASEARCH}" />
david_williamseb49d082007-05-01 03:03:15 +0000201
tle170c7902008-10-02 03:15:49 +0000202 <jvmarg
203 value="-Dnoclean=true" />
204 <jvmarg
205 value="-DbuildBranch=${buildBranch}" />
206 <jvmarg
207 value="-DbuildType=${buildType}" />
208 <jvmarg
209 value="-DbuildId=${buildId}" />
210 <jvmarg
211 value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" />
david_williams249fae52008-05-02 03:41:42 +0000212 <jvmarg
213 value="-Dprojectname=${projectname}" />
tle170c7902008-10-02 03:15:49 +0000214 <arg
215 value="-nosplash" />
216 <arg
217 value="-consolelog" />
218 <arg
219 value="-data" />
220 <arg
221 value="${testRoot}/overallTestWorkspace" />
222 <arg
223 value="-application" />
224 <arg
225 value="org.eclipse.ant.core.antRunner" />
226 <arg
227 value="-file" />
228 <arg
229 value="${testRoot}/test.xml" />
230 <arg
231 value="-logger" />
232 <arg
233 value="org.apache.tools.ant.DefaultLogger" />
david_williams403beae2007-12-09 02:10:40 +0000234 <env
235 key="DISPLAY"
236 value="${env.DISPLAY}" />
237 <redirector
238 output="${testRoot}/results/fullOutput.txt"
239 error="${testRoot}/results/fullErrorLog.txt" />
240 <sysproperty
241 key="build.home"
242 value="${env.BUILD_HOME}" />
243 <sysproperty
244 key="buildDirectory"
245 value="${buildDirectory}" />
246 <sysproperty
247 key="buildLabel"
248 value="${buildLabel}" />
249 <sysproperty
250 key="baseLocation"
251 value="${baseLocation}" />
252 <sysproperty
253 key="testRoot"
254 value="${testRoot}" />
255 <sysproperty
256 key="testDir"
257 value="${testRoot}" />
258 <sysproperty
259 key="perf.buildId"
260 value="${buildType}${date}-${time}" />
261 <sysproperty
262 key="eclipseBuilderDirectory"
263 value="${pde.builder.path}" />
264 <sysproperty
265 key="buildLabel"
266 value="${buildLabel}" />
267 </java>
tle170c7902008-10-02 03:15:49 +0000268 <echo
269 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
david_williams403beae2007-12-09 02:10:40 +0000270 </target>
tle170c7902008-10-02 03:15:49 +0000271 <target
272 name="postRunTestEclipse">
david_williams403beae2007-12-09 02:10:40 +0000273 <copy
tle170c7902008-10-02 03:15:49 +0000274 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
275 overwrite="true"
276 failonerror="false">
277 <fileset
278 dir="${testRoot}/results">
279 <include
280 name="*output.txt" />
281 </fileset>
282 </copy>
283 <copy
284 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
285 overwrite="true"
286 failonerror="false">
287 <fileset
288 dir="${testRoot}/results">
289 <include
290 name="*error.txt" />
291 </fileset>
292 </copy>
293 <copy
294 file="${testRoot}/results/fullOutput.txt"
295 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
296 overwrite="true"
297 failonerror="false">
298 </copy>
299 <copy
300 file="${testRoot}/results/fullErrorLog.txt"
301 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
302 overwrite="true"
303 failonerror="false">
304 </copy>
305 <copy
306 todir="${buildDirectory}/${buildLabel}/testResults/xml"
307 overwrite="true"
308 failonerror="false">
309 <fileset
310 dir="${testRoot}/results/xml">
311 <include
312 name="*.xml" />
313 </fileset>
314 </copy>
315 <copy
316 todir="${buildDirectory}/${buildLabel}/testResults/html"
317 overwrite="true"
318 failonerror="false">
319 <fileset
320 dir="${testRoot}/results/html">
321 <include
322 name="*.html" />
david_williams403beae2007-12-09 02:10:40 +0000323 </fileset>
324 </copy>
325 </target>
tle170c7902008-10-02 03:15:49 +0000326</project>