blob: c69d0a84a5d2fc82c02e5e0c6b4846336b519422 [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
62 dir="${testRoot}/results"
63 failOnError="false"/>
david_williams2398e362011-03-05 02:45:39 +000064 <mkdir dir="${testRoot}/results"/>
65 <mkdir dir="${testRoot}/results/consolelogs"/>
david_williams8a0244f2010-04-16 05:48:42 +000066 <copy
67 todir="${testRoot}"
68 overwrite="true">
david_williams2398e362011-03-05 02:45:39 +000069 <fileset dir="${test.component.dir}/testScripts"/>
david_williams8a0244f2010-04-16 05:48:42 +000070 </copy>
david_williams2398e362011-03-05 02:45:39 +000071 <echo message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} "/>
david_williamsf46c7712010-08-08 01:58:59 +000072
david_williams8a0244f2010-04-16 05:48:42 +000073 <property
74 name="dependency.properties"
david_williamsf46c7712010-08-08 01:58:59 +000075 value="${buildDirectory}/maps/${env.RELENG}/${dependencyFileLocation}"/>
david_williams8a0244f2010-04-16 05:48:42 +000076 <available
77 file="${dependency.properties}"
78 property="dependency.properties.exists"/>
79 <fail
80 message="dependency file not found: ${dependency.properties}"
81 unless="dependency.properties.exists"/>
82 <ant
83 antfile="${test.component.dir}/testdependency.xml"
84 target="get">
85 <property
86 name="base.install.dir"
87 value="${testRoot}"/>
88 </ant>
david_williams2398e362011-03-05 02:45:39 +000089 <antcall target="unzipTests"/>
90 <antcall target="runTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +000091 <param
92 name="testTarget"
93 value="all"/>
94 </antcall>
david_williams2398e362011-03-05 02:45:39 +000095 <antcall target="postRunTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +000096 <param
97 name="testTarget"
98 value="all"/>
99 </antcall>
100 </target>
david_williams2398e362011-03-05 02:45:39 +0000101 <target name="unzipTests">
david_williams8a0244f2010-04-16 05:48:42 +0000102 <!--
103 unzip the builds and junit tests we use 'unzip' here, so we
104 can continue on error, if desired. (such as if zip was not
105 created, due to other failures or options).
106 -->
107 <exec
108 dir="${buildDirectory}/${buildLabel}"
109 executable="unzip"
110 failonerror="true">
david_williams2398e362011-03-05 02:45:39 +0000111 <arg line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000112 </exec>
113 <exec
114 dir="${buildDirectory}/${buildLabel}"
115 executable="unzip"
116 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000117 <arg line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000118 </exec>
119 <exec
120 dir="${buildDirectory}/${buildLabel}"
121 executable="unzip"
122 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000123 <arg line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000124 </exec>
125 <exec
126 dir="${buildDirectory}/${buildLabel}"
127 executable="unzip"
128 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000129 <arg line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000130 </exec>
131 <exec
132 dir="${buildDirectory}/${buildLabel}"
133 executable="unzip"
134 failonerror="true">
david_williams2398e362011-03-05 02:45:39 +0000135 <arg line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}${dropinsFolder}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000136 </exec>
137 </target>
138 <!--
139 time out may need to be set/adjust for api or performance tests?
140 This testTimeLimit is the whole, overall limit on tests. There's
141 a shorter one for individual suites. some common values, of
142 milliseconds to more recognizable units:
143 18000000: 5 hours
144 14400000: 4 hours
145 7200000: 2 hours
146 3600000: 1 hour
147 1800000: 30 minutes
148 600000: 10 minutes
149 -->
150 <property
151 name="testTimeLimit"
152 value="36000000"/>
153 <property
154 name="testFailOnError"
155 value="false"/>
156 <target
157 name="runTestEclipse"
158 description="Run our JUnit's within an instance of antRunner">
159 <property
160 name="test-vm"
161 value="${env.JAVA_6_HOME}/bin/java"/>
162 <!--
163 set path to eclipse folder. If local folder, use '.';
164 otherwise, use c:\path\to\eclipse or /path/to/eclipse/
165 -->
166 <property
167 name="eclipse.home"
168 value="${testRoot}"/>
david_williams2398e362011-03-05 02:45:39 +0000169 <echo message="testTarget: ${testTarget}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000170 <!--
171 can not pass in empty values in jvmargs so if not testBundle
172 specified, we'll pass a junk (unused) value
173 -->
174 <condition
175 property="testBundleParam"
176 value="-DtestBundle=${testBundle}"
177 else="-Dunused=nouse">
david_williams2398e362011-03-05 02:45:39 +0000178 <isset property="testBundle"/>
david_williams8a0244f2010-04-16 05:48:42 +0000179 </condition>
david_williams2398e362011-03-05 02:45:39 +0000180 <echo message="Running junits"/>
david_williams8a0244f2010-04-16 05:48:42 +0000181 <!--
182 If there is not exactly one launcher in the stack, we'd best
183 fail fast, since we are not expecting that, and may indicate
184 an installation that would produce unpredictable results
185 -->
186 <!--
187 requires ant 1.7, and at this point, we're running 1.6 from
188 eclipse ... <condition property="expectedNumberOfLaunchers">
189 <resourcecount when="equal" count="1" > <fileset
190 dir="${testRoot}/eclipse/plugins"> <include
191 name="org.eclipse.equinox.launcher_*.jar" /> </fileset>
192 </resourcecount> </condition> <fail message="Did not find
193 expected number of launcher jars. Check installation."
194 unless="expectedNumberOfLaunchers" />
195 -->
196 <!--
197 Remember: using dash 'debug' for org.eclipse.ant.core.antRunner
198 produces ant debug info to be output ... which is a TON of
199 stuff. Even 'verbose' is a bit too much.
200 -->
david_williams2398e362011-03-05 02:45:39 +0000201 <echo message="eclipse.launcher: ${eclipse.launcher}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000202 <java
203 taskname="unit-test-masterprocess"
204 fork="true"
205 resultProperty="wtpmasterjunitresult"
206 failonerror="false"
207 timeout="${testTimeLimit}"
208 dir="${testRoot}/eclipse"
209 jvm="${env.JAVA_6_HOME}/bin/java"
210 classname="org.eclipse.equinox.launcher.Main">
211 <classpath>
david_williams2398e362011-03-05 02:45:39 +0000212 <fileset dir="${testRoot}/eclipse/plugins">
213 <include name="org.eclipse.equinox.launcher_*.jar"/>
david_williams8a0244f2010-04-16 05:48:42 +0000214 </fileset>
215 </classpath>
david_williams2398e362011-03-05 02:45:39 +0000216 <jvmarg value="-Dosgi.ws=${env.BASEWS}"/>
217 <jvmarg value="-Dosgi.os=${env.BASEOS}"/>
218 <jvmarg value="-Dosgi.arch=${env.BASEARCH}"/>
219 <jvmarg value="-Dws=${env.BASEWS}"/>
220 <jvmarg value="-Dos=${env.BASEOS}"/>
221 <jvmarg value="-Darch=${env.BASEARCH}"/>
222 <jvmarg value="-DbuildBranch=${buildBranch}"/>
223 <jvmarg value="-DbuildType=${buildType}"/>
224 <jvmarg value="-DdependencyFileLocation=${dependencyFileLocation}"/>
david_williamsbf62a202010-09-27 05:03:32 +0000225
david_williams2398e362011-03-05 02:45:39 +0000226 <jvmarg value="-DbuildId=${buildId}"/>
227 <jvmarg value="-Dprojectname=${projectname}"/>
228 <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/>
229 <jvmarg value="-Dwtp.builder.home=${wtp.builder.home}"/>
230 <jvmarg value="-Dbuild.distribution=${build.distribution}"/>
231 <jvmarg value="-Dorg.eclipse.jst.server.tomcat.50=${testRoot}/jakarta-tomcat-5.0.28"/>
232 <jvmarg value="${testBundleParam}"/>
233 <arg value="-nosplash"/>
234 <arg value="-consolelog"/>
235 <arg value="-data"/>
236 <arg value="${testRoot}/overallTestWorkspace"/>
237 <arg value="-application"/>
238 <arg value="org.eclipse.ant.core.antRunner"/>
239 <arg value="-logger"/>
240 <arg value="org.apache.tools.ant.DefaultLogger"/>
241 <arg value="-file"/>
242 <arg value="${testRoot}/perftest.xml"/>
243 <arg value="${testTarget}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000244
245 <!-- make sure our forked env has a DISPLAY -->
246 <env
247 key="DISPLAY"
248 value="${env.DISPLAY}"/>
249 <redirector
250 output="${testRoot}/results/fullOutput.txt"
251 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams2398e362011-03-05 02:45:39 +0000252 <jvmarg value="-Dbuild.home=${env.BUILD_HOME}"/>
253 <jvmarg value="-DbuildDirectory=${buildDirectory}"/>
254 <jvmarg value="-DbuildLabel=${buildLabel}"/>
255 <jvmarg value="-DbaseLocation=${baseLocation}"/>
256 <jvmarg value="-DtestRoot=${testRoot}"/>
257 <jvmarg value="-DtestDir=${testRoot}"/>
258 <jvmarg value="-DeclipseBuilderDirectory=${pde.builder.path}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000259 <!-- IBM_JAVA_OPTIONS contains JIT work arounds for bug 284441 -->
260 <env
261 key="IBM_JAVA_OPTIONS"
262 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)"/>
263 </java>
david_williams2398e362011-03-05 02:45:39 +0000264 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williams8a0244f2010-04-16 05:48:42 +0000265 </target>
david_williams2398e362011-03-05 02:45:39 +0000266 <target name="postRunTestEclipse">
david_williams8a0244f2010-04-16 05:48:42 +0000267 <copy
268 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
269 overwrite="true"
270 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000271 <fileset dir="${testRoot}/results">
272 <include name="*output.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000273 </fileset>
274 </copy>
275 <copy
276 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
277 overwrite="true"
278 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000279 <fileset dir="${testRoot}/results">
280 <include name="*error.txt"/>
david_williams8a0244f2010-04-16 05:48:42 +0000281 </fileset>
282 </copy>
283 <copy
284 file="${testRoot}/results/fullOutput.txt"
285 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
286 overwrite="true"
287 failonerror="false">
288 </copy>
289 <copy
290 file="${testRoot}/results/fullErrorLog.txt"
291 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
292 overwrite="true"
293 failonerror="false">
294 </copy>
295 <copy
296 todir="${buildDirectory}/${buildLabel}/testResults/xml"
297 overwrite="true"
298 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000299 <fileset dir="${testRoot}/results/xml">
300 <include name="*.xml"/>
david_williams8a0244f2010-04-16 05:48:42 +0000301 </fileset>
302 </copy>
303 <copy
304 todir="${buildDirectory}/${buildLabel}/testResults/html"
305 overwrite="true"
306 failonerror="false">
david_williams2398e362011-03-05 02:45:39 +0000307 <fileset dir="${testRoot}/results/html">
308 <include name="*.html"/>
david_williams8a0244f2010-04-16 05:48:42 +0000309 </fileset>
310 </copy>
311 </target>
312</project>