blob: e1844ab85ac280b01df25638b0319970dfbf0fca [file] [log] [blame]
david_williams5d9c9862007-11-19 04:42:55 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
david_williamsb1d22d62007-09-23 01:09:44 +00004
david_williams5d9c9862007-11-19 04:42:55 +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
8 be ${env.Path} not ${env.PATH} on Windows -->
9 <property environment="env" />
david_williamsb1d22d62007-09-23 01:09:44 +000010
david_williams5d9c9862007-11-19 04:42:55 +000011 <fail
12 message="testRoot must be set for this task"
13 unless="testRoot" />
david_williamsb1d22d62007-09-23 01:09:44 +000014
david_williams5d9c9862007-11-19 04:42:55 +000015 <!-- ===================================================================== -->
16 <!-- Steps to do after the build is done. -->
17 <!-- ===================================================================== -->
18 <target name="test">
19 <dirname
20 file="${ant.file}"
21 property="currentDirectory" />
22 <ant
23 antfile="${ant.file}"
24 target="runTest"
25 dir="${currentDirectory}" />
26 </target>
david_williamsb1d22d62007-09-23 01:09:44 +000027
david_williams5d9c9862007-11-19 04:42:55 +000028 <!-- ===================================================================== -->
29 <!-- Steps to do to test the build results -->
30 <!-- ===================================================================== -->
31 <target name="runTest">
david_williamsb1d22d62007-09-23 01:09:44 +000032
david_williams5d9c9862007-11-19 04:42:55 +000033 <dirname
34 file="${ant.file}"
35 property="test.component.dir" />
36 <ant antfile="${wtp.builder.home}/scripts/build/label.xml" />
37 <property file="${buildDirectory}/label.properties" />
38 <property file="${wtp.builder.home}/build.properties" />
david_williamsb1d22d62007-09-23 01:09:44 +000039
david_williams5d9c9862007-11-19 04:42:55 +000040 <fail
41 message="testRoot must be set for this task"
42 unless="testRoot" />
43 <mkdir dir="${testRoot}" />
david_williamsb1d22d62007-09-23 01:09:44 +000044
david_williams5d9c9862007-11-19 04:42:55 +000045 <!-- if results already exist, delete them -->
46 <delete
47 dir="${testRoot}/results"
48 failOnError="false" />
49 <mkdir dir="${testRoot}/results" />
david_williamsb1d22d62007-09-23 01:09:44 +000050
david_williams5d9c9862007-11-19 04:42:55 +000051 <mkdir dir="${testRoot}/results/consolelogs" />
52 <mkdir dir="${testRoot}/results/consolelogs/metadata-logs" />
53 <mkdir dir="${testRoot}/results/consolelogs/configuration-logs" />
david_williamsb1d22d62007-09-23 01:09:44 +000054
david_williams5d9c9862007-11-19 04:42:55 +000055 <copy
56 todir="${testRoot}"
57 overwrite="true">
58 <fileset dir="${test.component.dir}/testScripts"></fileset>
59 </copy>
david_williamsb1d22d62007-09-23 01:09:44 +000060
david_williams5d9c9862007-11-19 04:42:55 +000061 <echo
62 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
david_williamsb1d22d62007-09-23 01:09:44 +000063
david_williams5d9c9862007-11-19 04:42:55 +000064 <ant
65 antfile="${test.component.dir}/testdependency.xml"
66 target="get">
67 <property
68 name="dependency.properties"
69 value="${buildDirectory}/maps/${env.RELENG}/maps/dependencies.properties" />
70 <property
71 name="base.install.dir"
72 value="${testRoot}" />
73 </ant>
david_williamsb1d22d62007-09-23 01:09:44 +000074
david_williams5d9c9862007-11-19 04:42:55 +000075 <antcall target="unzipTests" />
david_williamsb1d22d62007-09-23 01:09:44 +000076
david_williams5d9c9862007-11-19 04:42:55 +000077 <antcall target="runTestEclipse">
78 <param
79 name="testTarget"
80 value="all" />
81 </antcall>
82 <antcall target="postRunTestEclipse">
83 <param
84 name="testTarget"
85 value="all" />
86 </antcall>
87 </target>
david_williamsb1d22d62007-09-23 01:09:44 +000088
david_williams5d9c9862007-11-19 04:42:55 +000089 <target name="unzipTests">
david_williams0c366d32006-12-10 07:08:39 +000090
david_williams5d9c9862007-11-19 04:42:55 +000091 <!--unzip the builds and junit tests
92 we use 'unzip' here, so we can continue on error
93 (such as if zip was not created, due to other failures or options).
94 -->
95 <exec
96 dir="${buildDirectory}/${buildLabel}"
97 executable="unzip"
98 failonerror="false">
99 <arg line="-o -qq wtp-${buildLabel}.zip -d ${testRoot}" />
100 </exec>
101 <exec
102 dir="${buildDirectory}/${buildLabel}"
103 executable="unzip"
104 failonerror="false">
105 <arg
106 line="-o -qq wtp-patches-tests-${buildLabel}.zip -d ${testRoot}" />
107 </exec>
david_williams0c366d32006-12-10 07:08:39 +0000108
david_williams5d9c9862007-11-19 04:42:55 +0000109 </target>
david_williamsc3b4f452007-09-30 08:28:17 +0000110
david_williams5d9c9862007-11-19 04:42:55 +0000111 <!-- time out may need to be set/adjust for api or performance tests?
112 This testTimeLimit is the whole, overall limit on tests. There's a shorter
113 one for individual suites.
114
115 some common values, of milliseconds to more recognizable units:
116 7200000: 2 hours
117 3600000: 1 hour
118 1800000: 30 minutes
119 600000: 10 minutes
120 -->
david_williams0c366d32006-12-10 07:08:39 +0000121
david_williams5d9c9862007-11-19 04:42:55 +0000122 <property
123 name="testTimeLimit"
124 value="7200000" />
125 <property
126 name="testFailOnError"
127 value="false" />
david_williams0c366d32006-12-10 07:08:39 +0000128
david_williams5d9c9862007-11-19 04:42:55 +0000129 <target
130 name="runTestEclipse"
131 description="Run our JUnit's within an instance of antRunner">
david_williams0c366d32006-12-10 07:08:39 +0000132
133
david_williams5d9c9862007-11-19 04:42:55 +0000134 <property
135 name="test-vm"
136 value="${env.JAVA_5_HOME}/bin/java" />
137 <property
138 name="plugin-path"
139 value="${testRoot}/eclipse/plugins" />
140 <property
141 name="vmargs"
142 value="-Xms256m -Xmx512m -Dosgi.ws=${env.BASEWS} -Dosgi.os=${env.BASEOS} -Dosgi.arch=${env.BASEARCH} -Dws=${env.BASEWS} -Dos=${env.BASEOS} -Darch=${env.BASEARCH} -Dosgi.clean=true -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_williams0c366d32006-12-10 07:08:39 +0000143
144
david_williams5d9c9862007-11-19 04:42:55 +0000145 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
146 <property
147 name="eclipse.home"
148 value="${testRoot}" />
david_williams0c366d32006-12-10 07:08:39 +0000149
david_williams5d9c9862007-11-19 04:42:55 +0000150 <echo message="Running junits" />
david_williams0c366d32006-12-10 07:08:39 +0000151
david_williams5d9c9862007-11-19 04:42:55 +0000152 <!-- If there is not exactly one launcher in the stack,
153 we'd best fail fast, since we are not expecting that,
154 and may indicate an installation that would produce unpredictable
155 results -->
156 <!-- requires ant 1.7, and at this point, we're running 1.6 from
157 eclipse ...
158
159 <condition property="expectedNumberOfLaunchers">
160 <resourcecount when="equal" count="1" >
161 <fileset dir="${testRoot}/eclipse/plugins">
162 <include name="org.eclipse.equinox.launcher_*.jar" />
163 </fileset>
164 </resourcecount>
165 </condition>
166 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
167 -->
168 <!--
169 Remember: using -debug for org.eclipse.ant.core.antRunner
170 produces ant debug info to be output ... which is a TON of stuff
171 -->
172 <echo message="eclipse.launcher: ${eclipse.launcher}" />
173 <java
174 jar="${eclipse.launcher}"
175 taskname="unit-test-masterprocess"
176 fork="true"
177 resultProperty="wtpmasterjunitresult"
178 failonerror="false"
179 timeout="${testTimeLimit}"
180 dir="${testRoot}/eclipse"
181 jvm="${env.JAVA_5_HOME}/bin/java">
david_williamsb1d22d62007-09-23 01:09:44 +0000182
david_williams5d9c9862007-11-19 04:42:55 +0000183 <jvmarg value="-Xms256m" />
184 <jvmarg value="-Xmx512m" />
david_williamsb1d22d62007-09-23 01:09:44 +0000185
david_williams5d9c9862007-11-19 04:42:55 +0000186 <jvmarg
187 value="-Declipse.launcher=${testRoot}/eclipse/startup.jar" />
188
189 <jvmarg value="-Dosgi.ws=${env.BASEWS}" />
190 <jvmarg value="-Dosgi.os=${env.BASEOS}" />
191 <jvmarg value="-Dosgi.arch=${env.BASEARCH}" />
192 <jvmarg value="-Dws=${env.BASEWS}" />
193 <jvmarg value="-Dos=${env.BASEOS}" />
194 <jvmarg value="-Darch=${env.BASEARCH}" />
195
196 <jvmarg value="-Dosgi.debug='false'" />
197
198 <jvmarg value="-Dosgi.clean=true" />
199
200 <jvmarg value="-DbuildBranch=${buildBranch}" />
201 <jvmarg value="-DbuildType=${buildType}" />
202 <jvmarg value="-DbuildId=${buildId}" />
203
204 <arg value="-nosplash" />
205 <arg value="-consolelog" />
206
207 <arg value="-data" />
208 <arg value="${testRoot}/overallTestWorkspace" />
209 <arg value="-application" />
210 <arg value="org.eclipse.ant.core.antRunner" />
211 <arg value="-file" />
212 <arg value="${testRoot}/test.xml" />
213 <arg value="-logger" />
214 <arg value="org.apache.tools.ant.DefaultLogger" />
215 <env
216 key="DISPLAY"
217 value="${env.DISPLAY}" />
218 <redirector
219 output="${testRoot}/results/fullOutput.txt"
220 error="${testRoot}/results/fullErrorLog.txt" />
221 <sysproperty
222 key="build.home"
223 value="${env.BUILD_HOME}" />
224 <sysproperty
225 key="buildDirectory"
226 value="${buildDirectory}" />
227 <sysproperty
228 key="buildLabel"
229 value="${buildLabel}" />
230 <sysproperty
231 key="baseLocation"
232 value="${baseLocation}" />
233 <sysproperty
234 key="testRoot"
235 value="${testRoot}" />
236 <sysproperty
237 key="testDir"
238 value="${testRoot}" />
239 <sysproperty
240 key="perf.buildId"
241 value="${buildType}${date}-${time}" />
242 <sysproperty
243 key="eclipseBuilderDirectory"
244 value="${pde.builder.path}" />
245 <sysproperty
246 key="buildLabel"
247 value="${buildLabel}" />
248 </java>
249
250 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}" />
251 </target>
david_williamsb1d22d62007-09-23 01:09:44 +0000252
253
david_williams5d9c9862007-11-19 04:42:55 +0000254 <target name="postRunTestEclipse">
255 <copy
256 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
257 overwrite="true"
258 failonerror="false">
259 <fileset dir="${testRoot}/results">
260 <include name="*output.txt" />
261 </fileset>
262 </copy>
263 <copy
264 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
265 overwrite="true"
266 failonerror="false">
267 <fileset dir="${testRoot}/results">
268 <include name="*error.txt" />
269 </fileset>
270 </copy>
271 <copy
272 file="${testRoot}/results/fullOutput.txt"
273 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
274 overwrite="true"
275 failonerror="false">
276 </copy>
277 <copy
278 file="${testRoot}/results/fullErrorLog.txt"
279 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
280 overwrite="true"
281 failonerror="false">
282 </copy>
david_williamsb1d22d62007-09-23 01:09:44 +0000283
david_williams5d9c9862007-11-19 04:42:55 +0000284 <copy
285 todir="${buildDirectory}/${buildLabel}/testResults/xml"
286 overwrite="true"
287 failonerror="false">
288 <fileset dir="${testRoot}/results/xml">
289 <include name="*.xml" />
290 </fileset>
291 </copy>
292 <copy
293 todir="${buildDirectory}/${buildLabel}/testResults/html"
294 overwrite="true"
295 failonerror="false">
296 <fileset dir="${testRoot}/results/html">
297 <include name="*.html" />
298 </fileset>
299 </copy>
300 </target>
david_williams0c366d32006-12-10 07:08:39 +0000301
302
303</project>