blob: 9067f8dbf0359206ac0fd6e2b38d9c7ed4173d48 [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">
david_williamseb49d082007-05-01 03:03:15 +000094 <arg line="-o -qq wtp-jpt-sdk-${buildLabel}.zip -d ${testRoot}" />
david_williamsf5f131a2007-03-17 06:12:13 +000095 </exec>
96 <exec dir="${buildDirectory}/${buildLabel}" executable="unzip"
97 failonerror="false">
98 <arg
david_williamseb49d082007-05-01 03:03:15 +000099 line="-o -qq wtp-jpt-Automated-Tests-${buildLabel}.zip -d ${testRoot}" />
david_williamsf5f131a2007-03-17 06:12:13 +0000100 </exec>
david_williamsa8187bf2006-12-11 02:37:50 +0000101
david_williamsf5f131a2007-03-17 06:12:13 +0000102 </target>
103
104 <!-- time out may need to be set/adjust for api or performance tests?
david_williams7795fd62007-03-18 18:16:37 +0000105 This testTimeLimit is the whole, overall limit on tests. There's a shorter
106 one for individual suites.
107
david_williamsf5f131a2007-03-17 06:12:13 +0000108 some common values, of milliseconds to more recognizable units:
109 7200000: 2 hours
110 3600000: 1 hour
111 1800000: 30 minutes
112 600000: 10 minutes
113 -->
david_williams7795fd62007-03-18 18:16:37 +0000114
david_williamsf5f131a2007-03-17 06:12:13 +0000115 <property name="testTimeLimit" value="7200000" />
116 <property name="testFailOnError" value="false" />
117
118 <target name="runTestEclipse"
119 description="Run our JUnit's within an instance of antRunner">
david_williams9d23a9d2007-03-16 02:23:53 +0000120
121
david_williamsf66fd6e2007-03-18 20:04:12 +0000122 <property name="test-vm" value="${env.JAVA_5_HOME}/bin/java" />
david_williamsd4e87622007-03-19 05:33:48 +0000123 <property name="plugin-path"
124 value="${testRoot}/eclipse/plugins" />
david_williamsf5f131a2007-03-17 06:12:13 +0000125 <property name="vmargs"
david_williams5bcfe582007-03-19 07:44:59 +0000126 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 +0000127
david_williams4b093692007-03-19 09:41:32 +0000128
129 <!-- set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse or /path/to/eclipse/ -->
130 <property name="eclipse.home" value="${testRoot}" />
131
david_williamsf5f131a2007-03-17 06:12:13 +0000132 <echo message="Running junits" />
david_williams9d23a9d2007-03-16 02:23:53 +0000133
david_williamsd364c6c2007-03-24 16:13:38 +0000134 <!-- If there is not exactly one launcher in the stack,
135 we'd best fail fast, since we are not expecting that,
136 and may indicate an installation that would produce unpredictable
137 results -->
david_williamsc7ccdf92007-03-25 05:53:08 +0000138 <!-- requires ant 1.7, and at this point, we're running 1.6 from
139 eclipse ...
140
david_williamsd364c6c2007-03-24 16:13:38 +0000141 <condition property="expectedNumberOfLaunchers">
david_williamsc05c1132007-03-25 00:45:15 +0000142 <resourcecount when="equal" count="1" >
david_williamsd364c6c2007-03-24 16:13:38 +0000143 <fileset dir="${testRoot}/eclipse/plugins">
144 <include name="org.eclipse.equinox.launcher_*.jar" />
145 </fileset>
146 </resourcecount>
147 </condition>
david_williams5c9207d2007-03-24 16:30:11 +0000148 <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" />
david_williamsc7ccdf92007-03-25 05:53:08 +0000149 -->
david_williamsac15c2b2007-03-26 20:37:53 +0000150 <!--
151 Remember: using -debug for org.eclipse.ant.core.antRunner
152 produces ant debug info to be output ... which is a TON of stuff
153 -->
david_williamsd364c6c2007-03-24 16:13:38 +0000154 <java
155 taskname="unit-test-masterprocess"
156 fork="true"
157 resultProperty="wtpmasterjunitresult"
158 failonerror="false"
159 timeout="${testTimeLimit}"
160 dir="${testRoot}/eclipse"
161 jvm="${env.JAVA_5_HOME}/bin/java"
162 classname="org.eclipse.equinox.launcher.Main">
david_williamsba084512007-03-24 05:22:35 +0000163 <classpath>
164 <fileset dir="${testRoot}/eclipse/plugins">
165 <include name="org.eclipse.equinox.launcher_*.jar" />
166 </fileset>
167 </classpath>
david_williamsd364c6c2007-03-24 16:13:38 +0000168
david_williamsdac7e452007-03-19 15:09:58 +0000169 <jvmarg value="-Xms256m"/>
170 <jvmarg value="-Xmx512m" />
david_williamsd364c6c2007-03-24 16:13:38 +0000171
david_williams5bcfe582007-03-19 07:44:59 +0000172 <jvmarg value="-Dosgi.ws=${env.BASEWS}" />
david_williams4b093692007-03-19 09:41:32 +0000173 <jvmarg value="-Dosgi.os=${env.BASEOS}" />
174 <jvmarg value="-Dosgi.arch=${env.BASEARCH}" />
175 <jvmarg value="-Dws=${env.BASEWS}" />
176 <jvmarg value="-Dos=${env.BASEOS}" />
177 <jvmarg value="-Darch=${env.BASEARCH}" />
david_williamsd364c6c2007-03-24 16:13:38 +0000178
david_williams4b093692007-03-19 09:41:32 +0000179 <jvmarg value="-Dosgi.clean=true" />
180 <jvmarg value="-Dnoclean=true" />
181 <jvmarg value="-DbuildBranch=${buildBranch}" />
182 <jvmarg value="-DbuildType=${buildType}" />
183 <jvmarg value="-DbuildId=${buildId}" />
184
185 <arg value="-nosplash" />
david_williamsacc88862007-03-25 21:33:54 +0000186 <arg value="-consolelog" />
david_williamsac15c2b2007-03-26 20:37:53 +0000187
david_williamsd364c6c2007-03-24 16:13:38 +0000188 <arg value="-data" />
189 <arg value="${testRoot}/overallTestWorkspace" />
david_williams4b093692007-03-19 09:41:32 +0000190 <arg value="-application" />
191 <arg value="org.eclipse.ant.core.antRunner" />
192 <arg value="-file" />
193 <arg value="${testRoot}/test.xml" />
194 <arg value="-logger" />
195 <arg value="org.apache.tools.ant.DefaultLogger" />
david_williamsd66af272007-03-18 19:04:10 +0000196 <env key="DISPLAY" value="${env.DISPLAY}" />
david_williamsd364c6c2007-03-24 16:13:38 +0000197 <redirector
198 output="${testRoot}/results/fullOutput.txt"
david_williamsacc88862007-03-25 21:33:54 +0000199 error="${testRoot}/results/fullErrorLog.txt"/>
david_williams4b093692007-03-19 09:41:32 +0000200 <sysproperty key="build.home" value="${env.BUILD_HOME}" />
201 <sysproperty key="buildDirectory" value="${buildDirectory}" />
david_williams535d6812007-03-29 06:46:26 +0000202 <sysproperty key="buildLabel" value="${buildLabel}" />
david_williams4b093692007-03-19 09:41:32 +0000203 <sysproperty key="baseLocation" value="${baseLocation}" />
204 <sysproperty key="testRoot" value="${testRoot}" />
205 <sysproperty key="testDir" value="${testRoot}" />
206 <sysproperty key="perf.buildId"
207 value="${buildType}${date}-${time}" />
208 <sysproperty key="eclipseBuilderDirectory"
209 value="${pde.builder.path}" />
210 <sysproperty key="buildLabel" value="${buildLabel}" />
david_williams7795fd62007-03-18 18:16:37 +0000211 </java>
david_williams9d23a9d2007-03-16 02:23:53 +0000212
david_williams4b093692007-03-19 09:41:32 +0000213 <echo message="wtpmasterjunitresult ${wtpmasterjunitresult}"/>
david_williamsf5f131a2007-03-17 06:12:13 +0000214 </target>
david_williams9d23a9d2007-03-16 02:23:53 +0000215
david_williamsd4e87622007-03-19 05:33:48 +0000216
david_williamsf5f131a2007-03-17 06:12:13 +0000217 <target name="postRunTestEclipse">
218 <copy
219 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testLogs"
david_williamsd4e87622007-03-19 05:33:48 +0000220 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000221 <fileset dir="${testRoot}/results">
david_williams70065ab2007-03-17 08:33:44 +0000222 <include name="*output.txt" />
david_williamsf5f131a2007-03-17 06:12:13 +0000223 </fileset>
224 </copy>
225 <copy
226 todir="${buildDirectory}/${buildLabel}/testResults/consolelogs/testSysErrorLogs"
david_williamsd4e87622007-03-19 05:33:48 +0000227 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000228 <fileset dir="${testRoot}/results">
david_williams70065ab2007-03-17 08:33:44 +0000229 <include name="*error.txt" />
david_williamsf5f131a2007-03-17 06:12:13 +0000230 </fileset>
231 </copy>
232 <copy file="${testRoot}/results/fullOutput.txt"
233 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
david_williamsd4e87622007-03-19 05:33:48 +0000234 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000235 </copy>
236 <copy file="${testRoot}/results/fullErrorLog.txt"
237 toDir="${buildDirectory}/${buildLabel}/testResults/consolelogs/full"
david_williamsd4e87622007-03-19 05:33:48 +0000238 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000239 </copy>
ndaib8cedc82005-09-13 18:00:32 +0000240
david_williamsf5f131a2007-03-17 06:12:13 +0000241 <copy todir="${buildDirectory}/${buildLabel}/testResults/xml"
david_williams4b3c8042007-03-19 01:06:50 +0000242 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000243 <fileset dir="${testRoot}/results/xml">
244 <include name="*.xml" />
245 </fileset>
246 </copy>
247 <copy todir="${buildDirectory}/${buildLabel}/testResults/html"
david_williams4b3c8042007-03-19 01:06:50 +0000248 overwrite="true" failonerror="false">
david_williamsf5f131a2007-03-17 06:12:13 +0000249 <fileset dir="${testRoot}/results/html">
250 <include name="*.html" />
251 </fileset>
252 </copy>
253 </target>
ndaib8cedc82005-09-13 18:00:32 +0000254
ndaib8cedc82005-09-13 18:00:32 +0000255
256</project>