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