blob: c417b7537d1efbf49df45baf737aafad8353870d [file] [log] [blame]
david_williams88cbf012009-01-12 21:53:05 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
4
5 <!-- 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
8 be ${env.Path} not ${env.PATH} on Windows -->
9 <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
21
22 <!--
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}" />
34 </target>
35
36 <!--
37 Steps to do to test the build results
38 -->
39 <target
40 name="runTest">
41 <dirname
42 file="${ant.file}"
43 property="test.component.dir" />
44 <ant
45 antfile="${wtp.builder.home}/scripts/build/label.xml" />
46 <property
47 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}" />
55
56 <!-- 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" />
68 <copy
69 todir="${testRoot}"
70 overwrite="true">
71 <fileset
72 dir="${test.component.dir}/testScripts" />
73 </copy>
74 <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"
81 value="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties" />
82 <property
83 name="base.install.dir"
84 value="${testRoot}" />
85 </ant>
86 <antcall
87 target="unzipTests" />
88 <antcall
89 target="runTestEclipse">
90 <param
91 name="testTarget"
92 value="all" />
93 </antcall>
94 <antcall
95 target="postRunTestEclipse">
96 <param
97 name="testTarget"
98 value="all" />
99 </antcall>
100 </target>
101 <target
102 name="unzipTests">
103
104 <!--unzip the builds and junit tests
105 we use 'unzip' here, so we can continue on error, if desired.
106 (such as if zip was not created, due to other failures or options).
107 -->
108 <echo
109 message="installing sdk" />
110 <exec
111 dir="${buildDirectory}/${buildLabel}"
112 executable="unzip"
113 failonerror="true">
114 <arg
115 line="-o -qq @zipprefix@-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
116 </exec>
117 <echo
118 message="installing tests" />
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="true">
123 <arg
124 line="-o -qq @zipprefix@-tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}" />
125 </exec>
126 </target>
127
128 <!-- 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 -->
138 <property
139 name="testTimeLimit"
140 value="7200000" />
141 <property
142 name="testFailOnError"
143 value="false" />
144 <target
145 name="runTestEclipse"
146 description="Run our JUnit's within an instance of antRunner">
147 <property
148 name="test-vm"
149 value="${env.JAVA_6_HOME}/bin/java" />
150 <property
151 name="plugin-path"
152 value="${testRoot}${dropinsFolder}/eclipse/plugins" />
153 <property
154 name="vmargs"
155 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}" />
156
157
158 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
159 <property
160 name="eclipse.home"
161 value="${testRoot}" />
162 <echo
163 message="Running junits" />
164
165 <!--
166 Remember: using -debug for org.eclipse.ant.core.antRunner
167 produces ant debug info to be output ... which is a TON of stuff
168 -->
169 <echo
170 message="eclipse.launcher: ${eclipse.launcher}" />
171 <java
172 taskname="unit-test-masterprocess"
173 fork="true"
174 resultProperty="wtpmasterjunitresult"
175 failonerror="false"
176 timeout="${testTimeLimit}"
177 dir="${testRoot}/eclipse"
178 jvm="${env.JAVA_6_HOME}/bin/java"
179 classname="org.eclipse.equinox.launcher.Main">
180 <classpath>
181 <fileset
182 dir="${testRoot}/eclipse/plugins">
183 <include
184 name="org.eclipse.equinox.launcher_*.jar" />
185 </fileset>
186 </classpath>
187 <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}" />
201
202 <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}" />
212 <jvmarg
213 value="-Dprojectname=${projectname}" />
214 <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" />
234 <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>
268 <echo
269 message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
270 </target>
271 <target
272 name="postRunTestEclipse">
273 <copy
274 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" />
323 </fileset>
324 </copy>
325 </target>
326</project>