david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 2 | <project |
| 3 | name="JUnit tests" |
| 4 | basedir="."> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 5 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 6 | <property environment="env" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 7 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 8 | <target name="init"> |
| 9 | <!-- |
| 10 | Parameters: |
| 11 | (Mandatory) |
| 12 | data-dir - the workspace directory for Eclipse to write its data |
| 13 | plugin-name - symboic name of the plugin to test |
| 14 | testPlugin - directory name of plugin (with version suffix) |
| 15 | classname - the name of the test class |
| 16 | |
| 17 | (Optional - overrides defaults set in script) |
| 18 | extraVMargs - allows separate setting of VM args from separate caller. |
| 19 | timeout - overrides default test timeout value (in milliseconds). |
| 20 | --> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 21 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 22 | <property |
| 23 | name="junit-report-output" |
| 24 | value="${testRoot}/results" /> |
| 25 | <mkdir dir="${junit-report-output}/raw" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 26 | |
| 27 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 28 | <!-- if not otherwise set, be sure extraVMargs is at least empty string --> |
| 29 | <property |
| 30 | name="extraVMargs" |
| 31 | value="" /> |
david_williams | 5ab33bf | 2007-03-20 03:15:25 +0000 | [diff] [blame] | 32 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 33 | <!-- if not otherwise set, use a unique workspace name --> |
| 34 | <property |
| 35 | name="data-dir" |
| 36 | value="${testRoot}/junitworkspaces/workspace-${classname}" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 37 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 38 | <property |
| 39 | name="testRoot" |
| 40 | value="${testRoot}" /> |
| 41 | <property |
| 42 | name="timeout" |
| 43 | value="1800000" /> |
| 44 | <property |
| 45 | name="junit-report-output" |
| 46 | value="${junit-report-output}" /> |
| 47 | <property |
| 48 | name="plugin-path" |
| 49 | value="${testRoot}/plugins/${testPlugin}" /> |
| 50 | <property |
| 51 | name="formatter" |
| 52 | value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter" /> |
| 53 | <property |
| 54 | name="test-output" |
| 55 | value="${junit-report-output}/raw/${classname}.xml" /> |
| 56 | <property |
| 57 | name="jvm" |
| 58 | value="${env.JAVA_5_HOME}/bin/java" /> |
| 59 | |
| 60 | <dirname |
| 61 | file="${ant.file}" |
| 62 | property="currentDir" /> |
| 63 | |
| 64 | |
| 65 | <echo |
| 66 | level="debug" |
| 67 | message="data-dir: ${data-dir}" /> |
| 68 | <echo |
| 69 | level="debug" |
| 70 | message="plugin-name: ${plugin-name}" /> |
| 71 | <echo |
| 72 | level="debug" |
| 73 | message="testPlugin: ${testPlugin}" /> |
| 74 | <echo |
| 75 | level="debug" |
| 76 | message="classname: ${classname}" /> |
| 77 | <echo |
| 78 | level="debug" |
| 79 | message="extraVMargs: ${extraVMargs}" /> |
| 80 | <echo |
| 81 | level="debug" |
| 82 | message="timeout: ${timeout}" /> |
| 83 | <echo |
| 84 | level="debug" |
| 85 | message="testRoot: ${testRoot}" /> |
| 86 | |
| 87 | <echo |
| 88 | level="debug" |
| 89 | message="basedir: ${basedir}" /> |
| 90 | <echo |
| 91 | level="debug" |
| 92 | message="eclipse-home: ${eclipse-home}" /> |
| 93 | <echo |
| 94 | level="debug" |
| 95 | message="plugin-path: ${plugin-path}" /> |
| 96 | <echo |
| 97 | level="debug" |
| 98 | message="junit-report-output: ${junit-report-output}" /> |
| 99 | <echo |
| 100 | level="debug" |
| 101 | message="test-output: ${test-output}" /> |
| 102 | <echo |
| 103 | level="debug" |
| 104 | message="buildDirectory: ${buildDirectory}" /> |
| 105 | <echo |
| 106 | level="debug" |
| 107 | message="buildLabel: ${buildLabel}" /> |
| 108 | |
| 109 | <echo |
| 110 | level="debug" |
| 111 | message="jvm: ${env.JAVA_5_HOME}/bin/java" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 112 | |
| 113 | |
| 114 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 115 | </target> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 116 | |
| 117 | |
| 118 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 119 | <target |
| 120 | name="core-test" |
| 121 | depends="init"> |
| 122 | <echo |
| 123 | level="info" |
| 124 | message="test-type: core-test" /> |
| 125 | <ant |
| 126 | antfile="${ant.file}" |
| 127 | dir="${currentDir}" |
| 128 | target="eclipse-test"> |
| 129 | <property |
| 130 | name="application" |
| 131 | value="org.eclipse.test.coretestapplication" /> |
| 132 | </ant> |
| 133 | </target> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 134 | |
| 135 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 136 | <target |
| 137 | name="ui-test" |
| 138 | depends="init"> |
| 139 | <echo |
| 140 | level="info" |
| 141 | message="test-type: ui-test" /> |
| 142 | <ant |
| 143 | antfile="${ant.file}" |
| 144 | dir="${currentDir}" |
| 145 | target="eclipse-test"> |
| 146 | <property |
| 147 | name="application" |
| 148 | value="org.eclipse.test.uitestapplication" /> |
| 149 | </ant> |
| 150 | </target> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 151 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 152 | <target |
| 153 | name="eclipse-test" |
| 154 | description="Runs the specified classname as a plug-in test."> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 155 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 156 | <echo |
| 157 | level="info" |
| 158 | message="Running ${classname}" /> |
| 159 | <echo |
| 160 | level="debug" |
| 161 | message="Result file: ${junit-report-output}/${classname}.xml." /> |
| 162 | <echo |
| 163 | level="debug" |
| 164 | message="DISPLAY: ${env.DISPLAY}" /> |
david_williams | 5ab33bf | 2007-03-20 03:15:25 +0000 | [diff] [blame] | 165 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 166 | <!-- If there is not exactly one launcher in the stack, |
| 167 | we'd best fail fast, since we are not expecting that, |
| 168 | and may indicate an installation that would produce unpredictable |
| 169 | results --> |
| 170 | <!-- requires ant 1.7, and at this point, we're running 1.6 from |
| 171 | eclipse ... |
| 172 | |
| 173 | <condition property="expectedNumberOfLaunchers"> |
| 174 | <resourcecount when="equal" count="1" > |
| 175 | <fileset dir="${testRoot}/eclipse/plugins"> |
| 176 | <include name="org.eclipse.equinox.launcher_*.jar" /> |
| 177 | </fileset> |
| 178 | </resourcecount> |
| 179 | </condition> |
| 180 | <fail message="Did not find expected number of launcher jars. Check installation." unless="expectedNumberOfLaunchers" /> |
| 181 | --> |
| 182 | <java |
| 183 | taskname="suiteUnitTest" |
| 184 | fork="true" |
| 185 | resultProperty="suitejunitresult" |
| 186 | failonerror="false" |
| 187 | timeout="${timeout}" |
| 188 | dir="${testRoot}/eclipse" |
| 189 | jvm="${env.JAVA_5_HOME}/bin/java" |
| 190 | classname="org.eclipse.equinox.launcher.Main"> |
| 191 | <classpath> |
| 192 | <fileset dir="${testRoot}/eclipse/plugins"> |
| 193 | <include name="org.eclipse.equinox.launcher_*.jar" /> |
| 194 | </fileset> |
| 195 | </classpath> |
david_williams | 5ab33bf | 2007-03-20 03:15:25 +0000 | [diff] [blame] | 196 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 197 | <jvmarg value="-Xms256m" /> |
| 198 | <jvmarg value="-Xmx1024m" /> |
| 199 | |
| 200 | <jvmarg value="-Dosgi.ws=${env.BASEWS}" /> |
| 201 | <jvmarg value="-Dosgi.os=${env.BASEOS}" /> |
| 202 | <jvmarg value="-Dosgi.arch=${env.BASEARCH}" /> |
| 203 | <jvmarg value="-DbuildLabel=${buildLabel}" /> |
| 204 | <jvmarg value="-DbuildDirectory=${buildDirectory}" /> |
david_williams | a750862 | 2008-01-28 17:27:30 +0000 | [diff] [blame] | 205 | |
| 206 | <jvmarg value="-Djava.protocol.handler.pkgs=com.ibm.etools.www.protocol" /> |
| 207 | <jvmarg value="-DurlLogLocation=${buildDirectory}/outgoinghttplogfromtests.log" /> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 208 | |
| 209 | <jvmarg value="-Dwtp.autotest.noninteractive=true" /> |
| 210 | <jvmarg value="-Dosgi.clean=true" /> |
| 211 | <jvmarg value="-DPLUGIN_PATH=${plugin-path}" /> |
| 212 | <jvmarg line="${extraVMargs}" /> |
david_williams | b93c1ee | 2008-02-10 21:27:40 +0000 | [diff] [blame] | 213 | <jvmarg value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}" /> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 214 | <arg value="-nosplash" /> |
| 215 | <arg value="-consolelog" /> |
| 216 | <arg value="-debug" /> |
| 217 | <arg value="-data" /> |
| 218 | <arg value="${data-dir}" /> |
| 219 | <arg value="-application" /> |
| 220 | <arg value="${application}" /> |
| 221 | <arg value="formatter=${formatter},${test-output}" /> |
| 222 | <arg value="-testPluginName" /> |
| 223 | <arg value="${plugin-name}" /> |
| 224 | <arg value="-className" /> |
| 225 | <arg value="${classname}" /> |
| 226 | <env |
| 227 | key="DISPLAY" |
| 228 | value="${env.DISPLAY}" /> |
| 229 | <redirector |
| 230 | output="${junit-report-output}/${classname}.output.txt" |
| 231 | error="${junit-report-output}/${classname}.error.txt" /> |
| 232 | </java> |
david_williams | d364c6c | 2007-03-24 16:13:38 +0000 | [diff] [blame] | 233 | |
david_williams | f37f43f | 2008-02-11 00:47:50 +0000 | [diff] [blame] | 234 | <antcall target="summarizeFailure" /> |
david_williams | 6f5ad42 | 2008-02-11 02:54:54 +0000 | [diff] [blame^] | 235 | |
| 236 | <antcall target="collect-results" /> |
| 237 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 238 | </target> |
| 239 | |
| 240 | <target name="collect-results"> |
| 241 | <dirname |
| 242 | property="output-dir" |
| 243 | file="${test-output}" /> |
| 244 | <basename |
| 245 | property="output-file-name" |
| 246 | file="${test-output}" /> |
| 247 | <mkdir dir="${junit-report-output}/xml" /> |
| 248 | <junitreport |
| 249 | todir="${junit-report-output}/xml" |
| 250 | tofile="${classname}.xml"> |
| 251 | <fileset dir="${output-dir}"> |
| 252 | <include name="${output-file-name}" /> |
| 253 | </fileset> |
| 254 | </junitreport> |
| 255 | |
| 256 | <mkdir dir="${junit-report-output}/html" /> |
david_williams | 6b198a7 | 2008-01-26 06:19:56 +0000 | [diff] [blame] | 257 | <xslt |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 258 | style="${testRoot}/JUNIT.XSL" |
| 259 | basedir="${junit-report-output}" |
| 260 | includes="${classname}.xml" |
| 261 | destdir="${junit-report-output}/html" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 262 | |
| 263 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 264 | <copy |
| 265 | file="${data-dir}/.metadata/.log" |
| 266 | toFile="${testRoot}/results/consolelogs/metadata-logs/${classname}.workspace.log" |
| 267 | overwrite="true" |
| 268 | failonError="false" /> |
david_williams | 5ab33bf | 2007-03-20 03:15:25 +0000 | [diff] [blame] | 269 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 270 | <!-- todo: this, especially, should be concat (there could be more than one, in theory) --> |
| 271 | <copy |
| 272 | file="${testRoot}/eclipse/configuration/*.log" |
| 273 | toFile="${testRoot}/results/consolelogs/configuration-logs/${classname}.config.log" |
| 274 | overwrite="true" |
| 275 | failonError="false" /> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 276 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 277 | </target> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 278 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 279 | <target name="collect"> |
| 280 | <!-- deprecated, each test.xml uses it, and we should remove, eventually --> |
| 281 | </target> |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 282 | |
| 283 | |
david_williams | f37f43f | 2008-02-11 00:47:50 +0000 | [diff] [blame] | 284 | <target name="summarizeFailure" depends="checkFailure" if="doFailure"> |
| 285 | |
david_williams | 6f5ad42 | 2008-02-11 02:54:54 +0000 | [diff] [blame^] | 286 | <echo |
| 287 | level="info" |
| 288 | message="suitejunitresult: ${suitejunitresult}" /> |
| 289 | |
| 290 | <echo append="true" file="${buildDirectory}/junitFailureList.log"> |
david_williams | f37f43f | 2008-02-11 00:47:50 +0000 | [diff] [blame] | 291 | ${plugin-name} |
| 292 | </echo> |
| 293 | |
| 294 | </target> |
david_williams | 6f5ad42 | 2008-02-11 02:54:54 +0000 | [diff] [blame^] | 295 | |
david_williams | f37f43f | 2008-02-11 00:47:50 +0000 | [diff] [blame] | 296 | <target name="checkFailure"> |
| 297 | |
| 298 | <condition property="doFailure"> |
| 299 | <not> |
| 300 | <equals |
| 301 | arg1="suitejunitresult" |
| 302 | arg2="0" |
| 303 | trim="true" /> |
| 304 | </not> |
| 305 | </condition> |
david_williams | 6f5ad42 | 2008-02-11 02:54:54 +0000 | [diff] [blame^] | 306 | |
| 307 | </target> |
david_williams | 5ab33bf | 2007-03-20 03:15:25 +0000 | [diff] [blame] | 308 | |
david_williams | 331eaf3 | 2007-03-17 22:39:31 +0000 | [diff] [blame] | 309 | </project> |