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