blob: d185510b882cf2895b89f6152258f20426647e09 [file] [log] [blame]
david_williams8a0244f2010-04-16 05:48:42 +00001<project
2 name="Build specific targets and properties"
3 default="runTest">
4 <!--
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_williams2398e362011-03-05 02:45:39 +000011 <property environment="env"/>
david_williams8a0244f2010-04-16 05:48:42 +000012 <fail
13 message="testRoot must be set for this task"
14 unless="testRoot"/>
15 <!-- required to get proper value of dropinsFolder -->
16 <property
17 name="keyCfgFile"
18 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
19 <echo
20 level="info"
21 message="keyCfgFile: ${keyCfgFile}"/>
david_williams2398e362011-03-05 02:45:39 +000022 <property file="${keyCfgFile}"/>
david_williams8a0244f2010-04-16 05:48:42 +000023 <!--
24 typcially already set, but in case of standalone tests, may not
25 be
26 -->
27 <property
28 name="buildLabel"
29 value="${buildType}-${buildId}-${timestamp}"/>
30
31
32 <!--
33 Steps to do after the build is done.
34 -->
david_williams2398e362011-03-05 02:45:39 +000035 <target name="test">
david_williams8a0244f2010-04-16 05:48:42 +000036 <dirname
37 file="${ant.file}"
38 property="currentDirectory"/>
39 <ant
40 antfile="${ant.file}"
41 target="runTest"
42 dir="${currentDirectory}"/>
43 </target>
44
45 <!--
46 Steps to do to test the build results
47 -->
david_williams2398e362011-03-05 02:45:39 +000048 <target name="runTest">
david_williams8a0244f2010-04-16 05:48:42 +000049 <dirname
50 file="${ant.file}"
51 property="test.component.dir"/>
david_williams2398e362011-03-05 02:45:39 +000052 <ant antfile="${wtp.builder.home}/scripts/build/label.xml"/>
53 <property file="${buildDirectory}/label.properties"/>
54 <property file="${wtp.builder.home}/build.properties"/>
david_williams8a0244f2010-04-16 05:48:42 +000055 <fail
56 message="testRoot must be set for this task"
57 unless="testRoot"/>
david_williams2398e362011-03-05 02:45:39 +000058 <mkdir dir="${testRoot}"/>
david_williams8a0244f2010-04-16 05:48:42 +000059
60 <!-- if results already exist, delete them -->
61 <delete
david_williams14cadd12011-03-23 06:43:39 +000062 quiet="true"
david_williams8a0244f2010-04-16 05:48:42 +000063 dir="${testRoot}/results"
64 failOnError="false"/>
david_williams2398e362011-03-05 02:45:39 +000065 <mkdir dir="${testRoot}/results"/>
66 <mkdir dir="${testRoot}/results/consolelogs"/>
david_williams8a0244f2010-04-16 05:48:42 +000067 <copy
68 todir="${testRoot}"
69 overwrite="true">
david_williams2398e362011-03-05 02:45:39 +000070 <fileset dir="${test.component.dir}/testScripts"/>
david_williams8a0244f2010-04-16 05:48:42 +000071 </copy>
david_williams2398e362011-03-05 02:45:39 +000072 <echo message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williamsf46c7712010-08-08 01:58:59 +000073
david_williams8a0244f2010-04-16 05:48:42 +000074 <property
75 name="dependency.properties"
david_williamsf46c7712010-08-08 01:58:59 +000076 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
david_williams8a0244f2010-04-16 05:48:42 +000077 <available
78 file="${dependency.properties}"
79 property="dependency.properties.exists"/>
80 <fail
81 message="dependency file not found: ${dependency.properties}"
82 unless="dependency.properties.exists"/>
83 <ant
84 antfile="${test.component.dir}/testdependency.xml"
85 target="get">
86 <property
87 name="base.install.dir"
88 value="${testRoot}"/>
89 </ant>
david_williams2398e362011-03-05 02:45:39 +000090 <antcall target="unzipTests"/>
91 <antcall target="runTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +000092 <param
93 name="testTarget"
94 value="all"/>
95 </antcall>
david_williams2398e362011-03-05 02:45:39 +000096 <antcall target="postRunTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +000097 <param
98 name="testTarget"
99 value="all"/>
100 </antcall>
101 </target>
david_williams2398e362011-03-05 02:45:39 +0000102 <target name="unzipTests">
david_williams8a0244f2010-04-16 05:48:42 +0000103 <!--
104 unzip the builds and junit tests we use 'unzip' here, so we
105 can continue on error, if desired. (such as if zip was not
106 created, due to other failures or options).
107 -->
108 <exec
109 dir="${buildDirectory}/${buildLabel}"
110 executable="unzip"
111 failonerror="true">
david_williams2398e362011-03-05 02:45:39 +0000112 <arg line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000113 </exec>
114 <exec
115 dir="${buildDirectory}/${buildLabel}"
116 executable="unzip"
117 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000118 <arg line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000119 </exec>
120 <exec
121 dir="${buildDirectory}/${buildLabel}"
122 executable="unzip"
123 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000124 <arg line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000125 </exec>
126 <exec
127 dir="${buildDirectory}/${buildLabel}"
128 executable="unzip"
129 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000130 <arg line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000131 </exec>
132 <exec
133 dir="${buildDirectory}/${buildLabel}"
134 executable="unzip"
135 failonerror="true">
david_williams2398e362011-03-05 02:45:39 +0000136 <arg line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000137 </exec>
138 </target>
139 <!--
140 time out may need to be set/adjust for api or performance tests?
141 This testTimeLimit is the whole, overall limit on tests. There's
142 a shorter one for individual suites. some common values, of
143 milliseconds to more recognizable units:
144 18000000: 5 hours
145 14400000: 4 hours
146 7200000: 2 hours
147 3600000: 1 hour
148 1800000: 30 minutes
149 600000: 10 minutes
150 -->
151 <property
152 name="testTimeLimit"
153 value="36000000"/>
154 <property
155 name="testFailOnError"
156 value="false"/>
157 <target
158 name="runTestEclipse"
159 description="Run our JUnit's within an instance of antRunner">
160 <property
161 name="test-vm"
162 value="${env.JAVA_6_HOME}/bin/java"/>
163 <!--
164 set path to eclipse folder. If local folder, use '.';
165 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
166 -->
167 <property
168 name="eclipse.home"
169 value="${testRoot}"/>
david_williams2398e362011-03-05 02:45:39 +0000170 <echo message="testTarget: ${testTarget}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000171 <!--
172 can not pass in empty values in jvmargs so if not testBundle
173 specified, we'll pass a junk (unused) value
174 -->
175 <condition
176 property="testBundleParam"
177 value="-DtestBundle=${testBundle}"
178 else="-Dunused=nouse">
david_williams2398e362011-03-05 02:45:39 +0000179 <isset property="testBundle"/>
david_williams8a0244f2010-04-16 05:48:42 +0000180 </condition>
david_williams2398e362011-03-05 02:45:39 +0000181 <echo message="Running junits"/>
david_williams8a0244f2010-04-16 05:48:42 +0000182 <!--
183 If there is not exactly one launcher in the stack, we'd best
184 fail fast, since we are not expecting that, and may indicate
185 an installation that would produce unpredictable results
186 -->
187 <!--
188 requires ant 1.7, and at this point, we're running 1.6 from
189 eclipse ... <condition property="expectedNumberOfLaunchers">
190 <resourcecount when="equal" count="1" > <fileset
191 dir="${testRoot}/eclipse/plugins"> <include
192 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
193 </resourcecount> </condition> <fail message="Did not find
194 expected number of launcher jars. Check installation."
195 unless="expectedNumberOfLaunchers" />
196 -->
david_williamsef62fc42011-03-18 02:33:39 +0000197
david_williamsba00a342011-03-12 05:11:19 +0000198 <condition
199 property="antQuietValue"
200 value="-quiet"
201 else="">
202 <istrue value="${env.USE_QUIET}"/>
203 </condition>
david_williams8a0244f2010-04-16 05:48:42 +0000204 <java
205 taskname="unit-test-masterprocess"
206 fork="true"
207 resultProperty="wtpmasterjunitresult"
208 failonerror="false"
209 timeout="${testTimeLimit}"
210 dir="${testRoot}/eclipse"
211 jvm="${env.JAVA_6_HOME}/bin/java"
212 classname="org.eclipse.equinox.launcher.Main">
213 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000214 <fileset dir="${testRoot}/eclipse/plugins">
215 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams8a0244f2010-04-16 05:48:42 +0000216 </fileset>
217 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000218 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
219 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
220 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
221 <jvmarg value="-Dws=${env.BASEWS}"/>
222 <jvmarg value="-Dos=${env.BASEOS}"/>
223 <jvmarg value="-Darch=${env.BASEARCH}"/>
224 <jvmarg value="-DbuildBranch=${buildBranch}"/>
225 <jvmarg value="-DbuildType=${buildType}"/>
226 <jvmarg value="-DdependencyFileLocation=${dependencyFileLocation}"/>
david_williamsbf62a202010-09-27 05:03:32 +0000227
david_williams2398e362011-03-05 02:45:39 +0000228 <jvmarg value="-DbuildId=${buildId}"/>
229 <jvmarg value="-Dprojectname=${projectname}"/>
230 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
231 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
232 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
233 <jvmarg value="-Dorg.eclipse.jst.server.tomcat.50=${testRoot}/jakarta-tomcat-5.0.28"/>
234 <jvmarg value="${testBundleParam}"/>
235 <arg value="-nosplash"/>
236 <arg value="-consolelog"/>
237 <arg value="-data"/>
238 <arg value="${testRoot}/overallTestWorkspace"/>
239 <arg value="-application"/>
240 <arg value="org.eclipse.ant.core.antRunner"/>
david_williamsba00a342011-03-12 05:11:19 +0000241 <arg value="${antQuietValue}"/>
david_williams2398e362011-03-05 02:45:39 +0000242 <arg value="-logger"/>
243 <arg value="org.apache.tools.ant.DefaultLogger"/>
244 <arg value="-file"/>
245 <arg value="${testRoot}/perftest.xml"/>
246 <arg value="${testTarget}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000247
248 <!-- make sure our forked env has a DISPLAY -->
249 <env
250 key="DISPLAY"
251 value="${env.DISPLAY}"/>
252 <redirector
253 output="${testRoot}/results/fullOutput.txt"
254 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2398e362011-03-05 02:45:39 +0000255 <jvmarg value="-Dbuild.home=${env.BUILD_HOME}"/>
256 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
257 <jvmarg value="-DbuildLabel=${buildLabel}"/>
258 <jvmarg value="-DbaseLocation=${baseLocation}"/>
259 <jvmarg value="-DtestRoot=${testRoot}"/>
260 <jvmarg value="-DtestDir=${testRoot}"/>
261 <jvmarg value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000262 <!-- IBM_JAVA_OPTIONS contains JIT work arounds for bug 284441 -->
263 <env
264 key="IBM_JAVA_OPTIONS"
265 value="-Xjit:{org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.primGetNextToken()Ljava/lang/String;}(disableLookahead),{org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.primGetNextToken()Ljava/lang/String;}(disableLookahead)"/>
266 </java>
david_williams2398e362011-03-05 02:45:39 +0000267 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000268 </target>
david_williams2398e362011-03-05 02:45:39 +0000269 <target name="postRunTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +0000270 <copy
271 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
272 overwrite="true"
273 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000274 <fileset dir="${testRoot}/results">
275 <include name="*output.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000276 </fileset>
277 </copy>
278 <copy
279 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
280 overwrite="true"
281 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000282 <fileset dir="${testRoot}/results">
283 <include name="*error.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000284 </fileset>
285 </copy>
286 <copy
287 file="${testRoot}/results/fullOutput.txt"
288 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
289 overwrite="true"
290 failonerror="false">
291 </copy>
292 <copy
293 file="${testRoot}/results/fullErrorLog.txt"
294 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
295 overwrite="true"
296 failonerror="false">
297 </copy>
298 <copy
299 todir="${buildDirectory}/${buildLabel}/testResults/xml"
300 overwrite="true"
301 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000302 <fileset dir="${testRoot}/results/xml">
303 <include name="*.xml"/>
david_williams8a0244f2010-04-16 05:48:42 +0000304 </fileset>
305 </copy>
306 <copy
307 todir="${buildDirectory}/${buildLabel}/testResults/html"
308 overwrite="true"
309 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000310 <fileset dir="${testRoot}/results/html">
311 <include name="*.html"/>
david_williams8a0244f2010-04-16 05:48:42 +0000312 </fileset>
313 </copy>
314 </target>
315</project>