| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
<project name="testsrc" basedir=".."> |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
<property name="test.library.dir" location="testsrc/tests" /> |
| 11 |
<property name="test.jstests.jar" location="${test.library.dir}/src/jstests.jar" /> |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
<property name="test.junit.url" value="http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar"/> |
| 17 |
<property name="test.hamcrest.url" value="http://central.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/> |
| 18 |
<property name="test.snakeyaml.url" value="http://central.maven.org/maven2/org/yaml/snakeyaml/1.15/snakeyaml-1.15.jar"/> |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
<property name="test.emma.url" value="http://repo1.maven.org/maven2/emma/emma/2.1.5320/emma-2.1.5320.jar"/> |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
<property name="test.emma_ant.url" value="http://repo1.maven.org/maven2/emma/emma_ant/2.1.5320/emma_ant-2.1.5320.jar"/> |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
<property name="test.classes" value="${build.dir}/test/classes" /> |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
<property name="test.output" value="${build.dir}/test/output" /> |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
<property name="test.timeout" value="60000" /> |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
<property name="test.vm.mx" value="256m" /> |
| 49 |
|
| 50 |
<target name="get-junit" unless="offline"> |
| 51 |
<mkdir dir="lib"/> |
| 52 |
<get src="${test.junit.url}" dest="lib/junit.jar" usetimestamp="true"/> |
| 53 |
<get src="${test.hamcrest.url}" dest="lib/hamcrest.jar" usetimestamp="true"/> |
| 54 |
<get src="${test.snakeyaml.url}" dest="lib/snakeyaml.jar" usetimestamp="true"/> |
| 55 |
</target> |
| 56 |
|
| 57 |
<target name="junit-compile"> |
| 58 |
<mkdir dir="${test.classes}" /> |
| 59 |
<antcall target="get-junit"/> |
| 60 |
<javac |
| 61 |
destdir="${test.classes}" debug="true" |
| 62 |
encoding="UTF-8" |
| 63 |
target="${target-jvm}" |
| 64 |
source="${source-level}" |
| 65 |
> |
| 66 |
<classpath> |
| 67 |
<pathelement path="lib/junit.jar" /> |
| 68 |
<pathelement path="lib/hamcrest.jar" /> |
| 69 |
<pathelement path="lib/snakeyaml.jar" /> |
| 70 |
<pathelement path="${classes}" /> |
| 71 |
</classpath> |
| 72 |
<src path="testsrc"/> |
| 73 |
<src path="examples"/> |
| 74 |
<exclude name="tests/**"/> |
| 75 |
</javac> |
| 76 |
<antcall target="copy-files" /> |
| 77 |
</target> |
| 78 |
|
| 79 |
<target name="compile"> |
| 80 |
<mkdir dir="${test.classes}" /> |
| 81 |
<antcall target="get-junit"/> |
| 82 |
<javac |
| 83 |
srcdir="testsrc" |
| 84 |
destdir="${test.classes}" debug="true" |
| 85 |
target="${target-jvm}" |
| 86 |
source="${source-level}" |
| 87 |
> |
| 88 |
<classpath> |
| 89 |
<pathelement path="lib/junit.jar" /> |
| 90 |
<pathelement path="lib/hamcrest.jar" /> |
| 91 |
<pathelement path="lib/snakeyaml.jar" /> |
| 92 |
<pathelement path="${classes}" /> |
| 93 |
</classpath> |
| 94 |
<sourcepath path="testsrc" /> |
| 95 |
<include name="org/mozilla/javascript/drivers/JsDriver.java" /> |
| 96 |
</javac> |
| 97 |
<antcall target="copy-files" /> |
| 98 |
</target> |
| 99 |
|
| 100 |
<target name="copy-files"> |
| 101 |
<copy todir="${test.classes}"> |
| 102 |
<fileset dir="testsrc"> |
| 103 |
<exclude name="**/*.java build.xml"/> |
| 104 |
</fileset> |
| 105 |
</copy> |
| 106 |
</target> |
| 107 |
|
| 108 |
<target name="clean"> |
| 109 |
<delete dir="${test.classes}" /> |
| 110 |
</target> |
| 111 |
|
| 112 |
<target name="get-emma" unless="offline"> |
| 113 |
<get src="${test.emma.url}" dest="lib/emma.jar" usetimestamp="true"/> |
| 114 |
<get src="${test.emma_ant.url}" dest="lib/emma_ant.jar" usetimestamp="true"/> |
| 115 |
</target> |
| 116 |
|
| 117 |
<target name="coverage-instrument" depends="get-emma"> |
| 118 |
<property name="coverage.dir" location="${build.dir}/coverage"/> |
| 119 |
<property name="coverage.classes.dir" location="${build.dir}/coverage/classes"/> |
| 120 |
<mkdir dir="${coverage.classes.dir}"/> |
| 121 |
<path id="emma.lib"> |
| 122 |
<pathelement location="lib/emma.jar" /> |
| 123 |
<pathelement location="lib/emma_ant.jar" /> |
| 124 |
</path> |
| 125 |
<taskdef resource="emma_ant.properties" classpathref="emma.lib" /> |
| 126 |
<property name="coverage.instrumentationfile" location="${coverage.dir}/instrumentation"/> |
| 127 |
<emma enabled="true"> |
| 128 |
<instr |
| 129 |
instrpath="${classes}" outdir="${coverage.classes.dir}" |
| 130 |
outfile="${coverage.instrumentationfile}" mode="copy"/> |
| 131 |
</emma> |
| 132 |
<copy todir="${coverage.classes.dir}"> |
| 133 |
<fileset dir="src" excludes="**/*.java"/> |
| 134 |
</copy> |
| 135 |
<copy todir="${coverage.classes.dir}"> |
| 136 |
<fileset dir="${classes}"/> |
| 137 |
</copy> |
| 138 |
<property name="coverage.outfile" location="${coverage.dir}/coverage"/> |
| 139 |
</target> |
| 140 |
|
| 141 |
<target name="junit" depends="junit-compile,coverage-instrument"> |
| 142 |
<junit printsummary="on" fork="true" forkmode="once" maxmemory="${test.vm.mx}" showoutput="true" |
| 143 |
failureproperty="junitFailed"> |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
<sysproperty key="java.awt.headless" value="true" /> |
| 149 |
<sysproperty key="mozilla.js.tests" value="${test.library.dir}" /> |
| 150 |
<sysproperty key="mozilla.js.tests.timeout" value="${test.timeout}" /> |
| 151 |
<sysproperty key="emma.coverage.out.file" value="${coverage.outfile}"/> |
| 152 |
|
| 153 |
<sysproperty key="user.language" value="en"/> |
| 154 |
<sysproperty key="user.country" value="US"/> |
| 155 |
<sysproperty key="user.timezone" value="America/Los_Angeles"/> |
| 156 |
<classpath> |
| 157 |
<pathelement location="${xbean.jar}"/> |
| 158 |
<pathelement location="${jsr173.jar}"/> |
| 159 |
<pathelement path="${coverage.classes.dir}" /> |
| 160 |
<pathelement path="${classes}" /> |
| 161 |
<pathelement path="${test.classes}" /> |
| 162 |
<pathelement path="lib/emma.jar"/> |
| 163 |
<pathelement path="lib/junit.jar" /> |
| 164 |
<pathelement path="lib/hamcrest.jar" /> |
| 165 |
<pathelement path="lib/snakeyaml.jar" /> |
| 166 |
<pathelement location="${test.jstests.jar}"/> |
| 167 |
</classpath> |
| 168 |
<batchtest todir="build/test"> |
| 169 |
|
| 170 |
<fileset dir="${test.classes}" includes="**/tests/**/*Test.class"/> |
| 171 |
<fileset dir="${test.classes}" includes="**/StandardTests.class"/> |
| 172 |
|
| 173 |
|
| 174 |
</batchtest> |
| 175 |
<formatter type="xml"/> |
| 176 |
<assertions> |
| 177 |
<enable/> |
| 178 |
</assertions> |
| 179 |
</junit> |
| 180 |
<mkdir dir="build/test/report"/> |
| 181 |
<junitreport todir="build/test/report"> |
| 182 |
<fileset dir="build/test" includes="*.xml"/> |
| 183 |
<report todir="build/test/report"/> |
| 184 |
</junitreport> |
| 185 |
</target> |
| 186 |
|
| 187 |
<target name="junit-benchmarks" depends="junit-compile"> |
| 188 |
<mkdir dir="build/test/benchmark"/> |
| 189 |
<junit printsummary="on" fork="true" forkmode="perTest" |
| 190 |
maxmemory="${test.vm.mx}" showoutput="true" |
| 191 |
dir="testsrc/benchmarks"> |
| 192 |
<sysproperty key="rhino.benchmark.report" value="../../build" /> |
| 193 |
<classpath> |
| 194 |
<pathelement path="${classes}" /> |
| 195 |
<pathelement path="${test.classes}" /> |
| 196 |
<pathelement path="lib/junit.jar" /> |
| 197 |
<pathelement path="lib/hamcrest.jar" /> |
| 198 |
<pathelement path="lib/snakeyaml.jar" /> |
| 199 |
<pathelement location="${test.jstests.jar}"/> |
| 200 |
</classpath> |
| 201 |
|
| 202 |
<batchtest todir="build/test/benchmark"> |
| 203 |
<fileset dir="${test.classes}" includes="**/benchmarks/SunSpiderBenchmark.class"/> |
| 204 |
</batchtest> |
| 205 |
<formatter type="xml"/> |
| 206 |
<assertions> |
| 207 |
<disable/> |
| 208 |
</assertions> |
| 209 |
</junit> |
| 210 |
|
| 211 |
<junit printsummary="on" fork="true" forkmode="perTest" |
| 212 |
maxmemory="${test.vm.mx}" showoutput="true" |
| 213 |
dir="testsrc/benchmarks"> |
| 214 |
<sysproperty key="rhino.benchmark.report" value="../../build" /> |
| 215 |
<classpath> |
| 216 |
<pathelement path="${classes}" /> |
| 217 |
<pathelement path="${test.classes}" /> |
| 218 |
<pathelement path="lib/junit.jar" /> |
| 219 |
<pathelement path="lib/hamcrest.jar" /> |
| 220 |
<pathelement path="lib/snakeyaml.jar" /> |
| 221 |
<pathelement location="${test.jstests.jar}"/> |
| 222 |
</classpath> |
| 223 |
<batchtest todir="build/test/benchmark"> |
| 224 |
<fileset dir="${test.classes}" includes="**/benchmarks/V8Benchmark.class"/> |
| 225 |
</batchtest> |
| 226 |
<formatter type="xml"/> |
| 227 |
<assertions> |
| 228 |
<disable/> |
| 229 |
</assertions> |
| 230 |
</junit> |
| 231 |
|
| 232 |
<mkdir dir="build/test/benchmark/report"/> |
| 233 |
<junitreport todir="build/test/benchmark/report"> |
| 234 |
<fileset dir="build/test/benchmark" includes="*.xml"/> |
| 235 |
<report todir="build/test/benchmark/report"/> |
| 236 |
</junitreport> |
| 237 |
</target> |
| 238 |
|
| 239 |
<target name="junit-coveragereport" depends="junit"> |
| 240 |
<property name="coverage.report.dir" location="${build.dir}/coverage/report"/> |
| 241 |
<mkdir dir="${coverage.report.dir}"/> |
| 242 |
<delete dir="${coverage.report.dir}"/> |
| 243 |
<mkdir dir="${coverage.report.dir}"/> |
| 244 |
<emma enabled="true"> |
| 245 |
<report> |
| 246 |
<fileset dir="${basedir}"> |
| 247 |
<include name="build/coverage/instrumentation"/> |
| 248 |
<include name="build/coverage/coverage"/> |
| 249 |
</fileset> |
| 250 |
<sourcepath> |
| 251 |
<dirset dir="${basedir}"> |
| 252 |
<include name="src"/> |
| 253 |
</dirset> |
| 254 |
</sourcepath> |
| 255 |
<html outfile="${coverage.report.dir}/index.html"/> |
| 256 |
<xml outfile="${coverage.report.dir}/emma.xml"/> |
| 257 |
</report> |
| 258 |
</emma> |
| 259 |
<fail if="junitFailed" message="JUnit test(s) failed"/> |
| 260 |
</target> |
| 261 |
|
| 262 |
<target name="jsdriver" depends="compile"> |
| 263 |
<tstamp> |
| 264 |
<format property="test.timestamp" pattern="yyyy.MM.dd.HH.mm.ss" /> |
| 265 |
</tstamp> |
| 266 |
<mkdir dir="${test.output}" /> |
| 267 |
<java |
| 268 |
fork="true" |
| 269 |
classname="org.mozilla.javascript.drivers.JsDriver" |
| 270 |
maxmemory="${test.vm.mx}" |
| 271 |
> |
| 272 |
<classpath> |
| 273 |
<pathelement location="${xbean.jar}"/> |
| 274 |
<pathelement location="${jsr173.jar}"/> |
| 275 |
<pathelement path="${classes}" /> |
| 276 |
<pathelement path="${test.classes}" /> |
| 277 |
<pathelement location="${test.jstests.jar}"/> |
| 278 |
</classpath> |
| 279 |
<arg value="-p" /> |
| 280 |
<arg file="${test.library.dir}" /> |
| 281 |
<arg value="-f" /> |
| 282 |
<arg value="${test.output}/rhino-test-results.${test.timestamp}.html" /> |
| 283 |
<arg value="--timeout" /> |
| 284 |
<arg value="${test.timeout}" /> |
| 285 |
</java> |
| 286 |
</target> |
| 287 |
|
| 288 |
<target name="copy-source"> |
| 289 |
<mkdir dir="${dist.dir}/testsrc"/> |
| 290 |
<copy todir="${dist.dir}/testsrc"> |
| 291 |
<fileset dir="testsrc"> |
| 292 |
<include name="**/*.java"/> |
| 293 |
<include name="**/*.js"/> |
| 294 |
<include name="**/*.jstest"/> |
| 295 |
<include name="**/*.doctest"/> |
| 296 |
<include name="**/*.properties"/> |
| 297 |
<include name="**/*.xml"/> |
| 298 |
<include name="**/*.html"/> |
| 299 |
<include name="**/*.jar"/> |
| 300 |
<include name="*.skip"/> |
| 301 |
<include name="*.tests"/> |
| 302 |
<include name="tests.tar.gz"/> |
| 303 |
</fileset> |
| 304 |
</copy> |
| 305 |
</target> |
| 306 |
</project> |