blob: 274231dff15a22451010b11c9620aebc1bc2a4bb [file] [log] [blame]
david_williamsd4e87622007-03-19 05:33:48 +00001<project name="Build specific targets and properties"
2 default="runTest">
ndaib8cedc82005-09-13 18:00:32 +00003
david_williamsf5f131a2007-03-17 06:12:13 +00004 <!-- Note to be cross-platform, "environment variables" are only appropriate for
5 some variables, e.g. ones we set, since properties are case sensitive, even if
6 the environment variables on your operating system are not, e.g. it will
7 be ${env.Path} not ${env.PATH} on Windows -->
8 <property environment="env" />
ndaib8cedc82005-09-13 18:00:32 +00009
david_williamsd4e87622007-03-19 05:33:48 +000010 <fail message="testRoot must be set for this task"
11 unless="testRoot" />
ndaib8cedc82005-09-13 18:00:32 +000012
david_williamsf5f131a2007-03-17 06:12:13 +000013 <!-- ===================================================================== -->
14 <!-- Steps to do after the build is done. -->
15 <!-- ===================================================================== -->
16 <target name="test">
david_williams4b3c8042007-03-19 01:06:50 +000017 <dirname file="${ant.file}" property="currentDirectory" />
david_williamsd4e87622007-03-19 05:33:48 +000018 <ant antfile="${ant.file}" target="runTest"
19 dir="${currentDirectory}" />
david_williamsf5f131a2007-03-17 06:12:13 +000020 </target>
ndaib8cedc82005-09-13 18:00:32 +000021
david_williamsf5f131a2007-03-17 06:12:13 +000022 <!-- ===================================================================== -->
23 <!-- Steps to do to test the build results -->
24 <!-- ===================================================================== -->
25 <target name="runTest">
ndaib8cedc82005-09-13 18:00:32 +000026
david_williamsf5f131a2007-03-17 06:12:13 +000027 <dirname file="${ant.file}" property="test.component.dir" />
28 <ant antfile="${wtp.builder.home}/scripts/build/label.xml" />
29 <property file="${buildDirectory}/label.properties" />
30 <property file="${wtp.builder.home}/build.properties" />
david_williamsce156292006-12-11 00:12:35 +000031
david_williamsd4e87622007-03-19 05:33:48 +000032 <fail message="testRoot must be set for this task"
33 unless="testRoot" />
david_williamsf5f131a2007-03-17 06:12:13 +000034 <mkdir dir="${testRoot}" />
35
36 <!-- if results already exist, delete them -->
david_williams7795fd62007-03-18 18:16:37 +000037 <delete dir="${testRoot}/results" failOnError="false" />
david_williamsf5f131a2007-03-17 06:12:13 +000038 <mkdir dir="${testRoot}/results" />
david_williams7795fd62007-03-18 18:16:37 +000039
david_williamsf5f131a2007-03-17 06:12:13 +000040 <mkdir dir="${testRoot}/results/consolelogs" />
41 <mkdir dir="${testRoot}/results/consolelogs/metadata-logs" />
42 <mkdir dir="${testRoot}/results/consolelogs/configuration-logs" />
43
44 <copy todir="${testRoot}" overwrite="true">
45 <fileset dir="${test.component.dir}/testScripts"></fileset>
46 </copy>
47
48 <echo
49 message="BASEOS: ${env.BASEOS} BASEWS: ${env.BASEWS} BASEARCH: ${env.BASEARCH} " />
50
51 <ant antfile="${test.component.dir}/testdependency.xml"
52 target="get">
53 <property name="dependency.properties"
54 value="${buildDirectory}/maps/releng/maps/dependencies.properties" />
55 <property name="base.install.dir" value="${testRoot}" />
56 </ant>
57
58 <antcall target="unzipTests" />
59
60 <antcall target="runTestEclipse">
61 <param name="testTarget" value="all" />
62 </antcall>
63 <antcall target="postRunTestEclipse">
64 <param name="testTarget" value="all" />
65 </antcall>
66
67 </target>
68
69 <target name="unzipTests">
70
71 <!--unzip the builds and junit tests
72 we use 'unzip' here, so we can continue on error
73 (such as if zip was not created, due to other failures or options).
74 -->
75 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
76 failonerror="false">
77 <arg line="-o -qq wtp-sdk-${buildLabel}.zip -d ${testRoot}" />
78 </exec>
79
80 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
81 failonerror="false">
82 <arg
83 line="-o -qq wtp-wst-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
84 </exec>
85 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
86 failonerror="false">
87 <arg
88 line="-o -qq wtp-jst-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
89 </exec>
david_williamsa8187bf2006-12-11 02:37:50 +000090
91
david_williamsf5f131a2007-03-17 06:12:13 +000092 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
93 failonerror="false">
94 <arg
95 line="-o -qq wtp-jsf-sdk-${buildLabel}.zip -d ${testRoot}" />
96 </exec>
97 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
98 failonerror="false">
99 <arg
100 line="-o -qq wtp-jsf-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
101 </exec>
david_williams0c366d32006-12-10 07:08:39 +0000102
david_williamsc7ee45b2006-10-01 01:12:56 +0000103
david_williamsf5f131a2007-03-17 06:12:13 +0000104 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
105 failonerror="false">
106 <arg line="-o -qq wtp-jpa-${buildLabel}.zip -d ${testRoot}" />
107 </exec>
108 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
109 failonerror="false">
110 <arg
111 line="-o -qq wtp-jpa-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
112 </exec>
david_williamsa8187bf2006-12-11 02:37:50 +0000113
david_williamsf5f131a2007-03-17 06:12:13 +0000114 </target>
115
116 <!-- time out may need to be set/adjust for api or performance tests?
david_williams7795fd62007-03-18 18:16:37 +0000117 This testTimeLimit is the whole, overall limit on tests. There's a shorter
118 one for individual suites.
119
david_williamsf5f131a2007-03-17 06:12:13 +0000120 some common values, of milliseconds to more recognizable units:
121 7200000: 2 hours
122 3600000: 1 hour
123 1800000: 30 minutes
124 600000: 10 minutes
125 -->
david_williams7795fd62007-03-18 18:16:37 +0000126
david_williamsf5f131a2007-03-17 06:12:13 +0000127 <property name="testTimeLimit" value="7200000" />
128 <property name="testFailOnError" value="false" />
129
130 <target name="runTestEclipse"
131 description="Run our JUnit's within an instance of antRunner">
david_williams9d23a9d2007-03-16 02:23:53 +0000132
133
david_williamsf66fd6e2007-03-18 20:04:12 +0000134 <property name="test-vm" value="${env.JAVA_5_HOME}/bin/java" />
david_williamsd4e87622007-03-19 05:33:48 +0000135 <property name="plugin-path"
136 value="${testRoot}/eclipse/plugins" />
david_williamsf5f131a2007-03-17 06:12:13 +0000137 <property name="vmargs"
david_williams5bcfe582007-03-19 07:44:59 +0000138 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_williams9d23a9d2007-03-16 02:23:53 +0000139
david_williams4b093692007-03-19 09:41:32 +0000140
141 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
142 <property name="eclipse.home" value="${testRoot}" />
143
david_williamsf5f131a2007-03-17 06:12:13 +0000144 <echo message="Running junits" />
david_williams9d23a9d2007-03-16 02:23:53 +0000145
david_williamsd364c6c2007-03-24 16:13:38 +0000146 <!-- If there is not exactly one launcher in the stack,
147 we'd best fail fast, since we are not expecting that,
148 and may indicate an installation that would produce unpredictable
149 results -->
150 <condition property="expectedNumberOfLaunchers">
151 <resourcecount when="equal" length="1" >
152 <fileset dir="${testRoot}/eclipse/plugins">
153 <include name="org.eclipse.equinox.launcher_*.jar" />
154 </fileset>
155 </resourcecount>
156 </condition>
157 <java
158 taskname="unit-test-masterprocess"
159 fork="true"
160 resultProperty="wtpmasterjunitresult"
161 failonerror="false"
162 timeout="${testTimeLimit}"
163 dir="${testRoot}/eclipse"
164 jvm="${env.JAVA_5_HOME}/bin/java"
165 classname="org.eclipse.equinox.launcher.Main">
david_williamsba084512007-03-24 05:22:35 +0000166 <classpath>
167 <fileset dir="${testRoot}/eclipse/plugins">
168 <include name="org.eclipse.equinox.launcher_*.jar" />
169 </fileset>
170 </classpath>
david_williamsd364c6c2007-03-24 16:13:38 +0000171
david_williamsdac7e452007-03-19 15:09:58 +0000172 <jvmarg value="-Xms256m"/>
173 <jvmarg value="-Xmx512m" />
david_williamsd364c6c2007-03-24 16:13:38 +0000174
david_williams5bcfe582007-03-19 07:44:59 +0000175 <jvmarg value="-Dosgi.ws=${env.BASEWS}" />
david_williams4b093692007-03-19 09:41:32 +0000176 <jvmarg value="-Dosgi.os=${env.BASEOS}" />
177 <jvmarg value="-Dosgi.arch=${env.BASEARCH}" />
178 <jvmarg value="-Dws=${env.BASEWS}" />
179 <jvmarg value="-Dos=${env.BASEOS}" />
180 <jvmarg value="-Darch=${env.BASEARCH}" />
david_williamsd364c6c2007-03-24 16:13:38 +0000181
david_williams4b093692007-03-19 09:41:32 +0000182 <jvmarg value="-Dosgi.clean=true" />
183 <jvmarg value="-Dnoclean=true" />
184 <jvmarg value="-DbuildBranch=${buildBranch}" />
185 <jvmarg value="-DbuildType=${buildType}" />
186 <jvmarg value="-DbuildId=${buildId}" />
187
188 <arg value="-nosplash" />
david_williamsd364c6c2007-03-24 16:13:38 +0000189 <arg value="-data" />
190 <arg value="${testRoot}/overallTestWorkspace" />
david_williams4b093692007-03-19 09:41:32 +0000191 <arg value="-application" />
192 <arg value="org.eclipse.ant.core.antRunner" />
193 <arg value="-file" />
194 <arg value="${testRoot}/test.xml" />
195 <arg value="-logger" />
196 <arg value="org.apache.tools.ant.DefaultLogger" />
david_williamsd66af272007-03-18 19:04:10 +0000197 <env key="DISPLAY" value="${env.DISPLAY}" />
david_williamsd364c6c2007-03-24 16:13:38 +0000198 <redirector
199 output="${testRoot}/results/fullOutput.txt"
200 error="${testRoot}/results/fullErrorLog.txt"
201 alwayslog="true" />
david_williams4b093692007-03-19 09:41:32 +0000202 <sysproperty key="build.home" value="${env.BUILD_HOME}" />
203 <sysproperty key="buildDirectory" value="${buildDirectory}" />
204 <sysproperty key="baseLocation" value="${baseLocation}" />
205 <sysproperty key="testRoot" value="${testRoot}" />
206 <sysproperty key="testDir" value="${testRoot}" />
207 <sysproperty key="perf.buildId"
208 value="${buildType}${date}-${time}" />
209 <sysproperty key="eclipseBuilderDirectory"
210 value="${pde.builder.path}" />
211 <sysproperty key="buildLabel" value="${buildLabel}" />
david_williams7795fd62007-03-18 18:16:37 +0000212 </java>
david_williams9d23a9d2007-03-16 02:23:53 +0000213
david_williams4b093692007-03-19 09:41:32 +0000214 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williamsf5f131a2007-03-17 06:12:13 +0000215 </target>
david_williams9d23a9d2007-03-16 02:23:53 +0000216
david_williamsd4e87622007-03-19 05:33:48 +0000217
david_williamsf5f131a2007-03-17 06:12:13 +0000218 <target name="postRunTestEclipse">
219 <copy
220 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
david_williamsd4e87622007-03-19 05:33:48 +0000221 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000222 <fileset dir="${testRoot}/results">
david_williams70065ab2007-03-17 08:33:44 +0000223 <include name="*output.txt" />
david_williamsf5f131a2007-03-17 06:12:13 +0000224 </fileset>
225 </copy>
226 <copy
227 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
david_williamsd4e87622007-03-19 05:33:48 +0000228 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000229 <fileset dir="${testRoot}/results">
david_williams70065ab2007-03-17 08:33:44 +0000230 <include name="*error.txt" />
david_williamsf5f131a2007-03-17 06:12:13 +0000231 </fileset>
232 </copy>
233 <copy file="${testRoot}/results/fullOutput.txt"
234 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
david_williamsd4e87622007-03-19 05:33:48 +0000235 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000236 </copy>
237 <copy file="${testRoot}/results/fullErrorLog.txt"
238 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
david_williamsd4e87622007-03-19 05:33:48 +0000239 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000240 </copy>
ndaib8cedc82005-09-13 18:00:32 +0000241
david_williamsf5f131a2007-03-17 06:12:13 +0000242 <copy todir="${buildDirectory}/${buildLabel}/testResults/xml"
david_williams4b3c8042007-03-19 01:06:50 +0000243 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000244 <fileset dir="${testRoot}/results/xml">
245 <include name="*.xml" />
246 </fileset>
247 </copy>
248 <copy todir="${buildDirectory}/${buildLabel}/testResults/html"
david_williams4b3c8042007-03-19 01:06:50 +0000249 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000250 <fileset dir="${testRoot}/results/html">
251 <include name="*.html" />
252 </fileset>
253 </copy>
254 </target>
ndaib8cedc82005-09-13 18:00:32 +0000255
ndaib8cedc82005-09-13 18:00:32 +0000256
257</project>