Wed, 03 Sep 2014 14:33:34 +0200
8056913: Limit the size of type info cache on disk
Reviewed-by: jlaskey, lagergren
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!--
4 Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 This code is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License version 2 only, as
9 published by the Free Software Foundation.
11 This code is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 version 2 for more details (a copy is included in the LICENSE file that
15 accompanied this code).
17 You should have received a copy of the GNU General Public License version
18 2 along with this work; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 or visit www.oracle.com if you need additional information or have any
23 questions.
24 -->
26 <project name="nashorn" default="test" basedir="..">
27 <import file="build-nasgen.xml"/>
28 <import file="code_coverage.xml"/>
30 <target name="init-conditions">
31 <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later -->
32 <property file="${user.home}/.nashorn.project.local.properties"/>
34 <loadproperties srcFile="make/project.properties"/>
35 <path id="dist.path">
36 <pathelement location="${dist.dir}"/>
37 </path>
38 <path id="nashorn.ext.path">
39 <pathelement location="${dist.dir}"/>
40 <pathelement location="${java.ext.dirs}"/>
41 </path>
42 <property name="ext.class.path" value="-Djava.ext.dirs="${toString:nashorn.ext.path}""/>
43 <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
44 <available file="/usr/local/bin/svn"/>
45 </condition>
46 <condition property="hg.executable" value="/usr/local/bin/hg" else="hg">
47 <available file="/usr/local/bin/hg"/>
48 </condition>
49 <condition property="git.executable" value="/usr/local/bin/git" else="git">
50 <available file="/usr/local/bin/git"/>
51 </condition>
52 <!-- check if JDK already has ASM classes -->
53 <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/>
54 <!-- check if testng.jar is avaiable -->
55 <available property="testng.available" file="${file.reference.testng.jar}"/>
56 <!-- check if Jemmy ang testng.jar are avaiable -->
57 <condition property="jemmy.jfx.testng.available" value="true">
58 <and>
59 <available file="${file.reference.jemmyfx.jar}"/>
60 <available file="${file.reference.jemmycore.jar}"/>
61 <available file="${file.reference.jemmyawtinput.jar}"/>
62 <available file="${file.reference.jfxrt.jar}"/>
63 <isset property="testng.available"/>
64 </and>
65 </condition>
67 <!-- enable/disable make code coverage -->
68 <condition property="cc.enabled">
69 <istrue value="${make.code.coverage}" />
70 </condition>
72 <!-- exclude tests in exclude lists -->
73 <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt">
74 <istrue value="${make.code.coverage}" />
75 </condition>
77 <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
78 <istrue value="${jfr}"/>
79 </condition>
80 </target>
82 <target name="init" depends="init-conditions, init-cc">
83 <!-- extends jvm args -->
84 <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
85 <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
87 <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
88 <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
89 <echo message="run.test.xms=${run.test.xms}"/>
90 <echo message="run.test.xmx=${run.test.xmx}"/>
92 </target>
94 <target name="prepare" depends="init">
95 <mkdir dir="${build.dir}"/>
96 <mkdir dir="${build.classes.dir}"/>
97 <mkdir dir="${build.classes.dir}/META-INF/services"/>
98 <mkdir dir="${build.test.classes.dir}"/>
99 <mkdir dir="${dist.dir}"/>
100 <mkdir dir="${dist.javadoc.dir}"/>
101 </target>
103 <target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
104 <delete includeemptydirs="true">
105 <fileset dir="${build.dir}" erroronmissingdir="false"/>
106 </delete>
107 <delete dir="${dist.dir}"/>
108 </target>
110 <!-- do it only if ASM is not available -->
111 <target name="compile-asm" depends="prepare" unless="asm.available">
112 <javac srcdir="${jdk.asm.src.dir}"
113 destdir="${build.classes.dir}"
114 excludes="**/optimizer/* **/xml/* **/attrs/*"
115 source="${javac.source}"
116 target="${javac.target}"
117 debug="${javac.debug}"
118 encoding="${javac.encoding}"
119 includeantruntime="false"/>
120 </target>
122 <target name="compile" depends="compile-asm" description="Compiles nashorn">
123 <javac srcdir="${src.dir}"
124 destdir="${build.classes.dir}"
125 classpath="${javac.classpath}"
126 source="${javac.source}"
127 target="${javac.target}"
128 debug="${javac.debug}"
129 encoding="${javac.encoding}"
130 includeantruntime="false" fork="true">
131 <compilerarg value="-J-Djava.ext.dirs="/>
132 <compilerarg value="-Xlint:all"/>
133 <compilerarg value="-XDignore.symbol.file"/>
134 <compilerarg value="-Xdiags:verbose"/>
135 </javac>
136 <copy todir="${build.classes.dir}/META-INF/services">
137 <fileset dir="${meta.inf.dir}/services/"/>
138 </copy>
139 <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
140 <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
141 </copy>
142 <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
143 <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
144 </copy>
145 <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
146 <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
147 </copy>
148 <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
150 <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
151 <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
152 <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
153 </target>
155 <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
156 <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
157 <fileset dir="${build.classes.dir}"/>
158 <manifest>
159 <attribute name="Archiver-Version" value="n/a"/>
160 <attribute name="Build-Jdk" value="${java.runtime.version}"/>
161 <attribute name="Built-By" value="n/a"/>
162 <attribute name="Created-By" value="Ant jar task"/>
163 <section name="jdk/nashorn/">
164 <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
165 <attribute name="Implementation-Version" value="${nashorn.version}"/>
166 </section>
167 </manifest>
168 </jar>
169 </target>
171 <target name="use-promoted-nashorn" depends="init">
172 <delete file="${dist.dir}/nashorn.jar"/>
173 <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
174 <property name="compile.suppress.jar" value="defined"/>
175 </target>
177 <target name="build-fxshell" depends="jar">
178 <description>Builds the javafx shell.</description>
179 <mkdir dir="${fxshell.classes.dir}"/>
180 <javac srcdir="${fxshell.dir}"
181 destdir="${fxshell.classes.dir}"
182 classpath="${dist.jar}:${javac.classpath}"
183 debug="${javac.debug}"
184 encoding="${javac.encoding}"
185 includeantruntime="false">
186 </javac>
187 <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
188 <fileset dir="${fxshell.classes.dir}"/>
189 <manifest>
190 <attribute name="Archiver-Version" value="n/a"/>
191 <attribute name="Build-Jdk" value="${java.runtime.version}"/>
192 <attribute name="Built-By" value="n/a"/>
193 <attribute name="Created-By" value="Ant jar task"/>
194 <section name="jdk/nashorn/">
195 <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/>
196 <attribute name="Implementation-Version" value="${nashorn.version}"/>
197 </section>
198 </manifest>
199 </jar>
200 </target>
202 <target name="javadoc" depends="jar">
203 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html"
204 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
205 additionalparam="-quiet" failonerror="true">
206 <classpath>
207 <pathelement location="${build.classes.dir}"/>
208 </classpath>
209 <fileset dir="${src.dir}" includes="**/*.java"/>
210 <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
211 <link href="http://docs.oracle.com/javase/8/docs/api/"/>
212 <!-- The following tags are used only in ASM sources - just ignore these -->
213 <tag name="label" description="label tag in ASM sources" enabled="false"/>
214 <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
215 <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
216 </javadoc>
217 </target>
219 <!-- generate javadoc only for nashorn extension api classes -->
220 <target name="javadocapi" depends="jar">
221 <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}"
222 windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true">
223 <classpath>
224 <pathelement location="${build.classes.dir}"/>
225 </classpath>
226 <fileset dir="${src.dir}" includes="jdk/nashorn/api/**/*.java"/>
227 <link href="http://docs.oracle.com/javase/8/docs/api/"/>
228 </javadoc>
229 </target>
232 <!-- generate shell.html for shell tool documentation -->
233 <target name="shelldoc" depends="jar">
234 <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
235 <jvmarg line="${ext.class.path}"/>
236 <arg value="-scripting"/>
237 <arg value="docs/genshelldoc.js"/>
238 </java>
239 </target>
241 <!-- generate all docs -->
242 <target name="docs" depends="javadoc, shelldoc"/>
244 <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
245 <target name="dist" depends="jar">
246 <zip destfile="${build.zip}" basedir=".."
247 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
248 <tar destfile="${build.gzip}" basedir=".." compression="gzip"
249 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
250 </target>
252 <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
253 <!-- testng task -->
254 <taskdef name="testng" classname="org.testng.TestNGAntTask"
255 classpath="${file.reference.testng.jar}"/>
257 <javac srcdir="${test.src.dir}"
258 destdir="${build.test.classes.dir}"
259 classpath="${javac.test.classpath}"
260 source="${javac.source}"
261 target="${javac.target}"
262 debug="${javac.debug}"
263 encoding="${javac.encoding}"
264 includeantruntime="false" fork="true">
265 <compilerarg value="-J-Djava.ext.dirs="/>
266 <compilerarg value="-Xlint:unchecked"/>
267 <compilerarg value="-Xlint:deprecation"/>
268 <compilerarg value="-Xdiags:verbose"/>
269 </javac>
271 <copy todir="${build.test.classes.dir}/META-INF/services">
272 <fileset dir="${test.src.dir}/META-INF/services/"/>
273 </copy>
275 <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources">
276 <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/>
277 </copy>
279 <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources">
280 <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/>
281 </copy>
283 <!-- tests that check nashorn internals and internal API -->
284 <jar jarfile="${nashorn.internal.tests.jar}">
285 <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
286 </jar>
288 <!-- tests that check nashorn script engine (jsr-223) API -->
289 <jar jarfile="${nashorn.api.tests.jar}">
290 <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
291 <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
292 <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
293 </jar>
295 </target>
297 <target name="generate-policy-file" depends="prepare">
298 <echo file="${build.dir}/nashorn.policy">
300 grant codeBase "file:/${toString:dist.path}/nashorn.jar" {
301 permission java.security.AllPermission;
302 };
304 grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
305 permission java.security.AllPermission;
306 };
308 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
309 permission java.security.AllPermission;
310 };
311 //// in case of absolute path:
312 grant codeBase "file:/${nashorn.internal.tests.jar}" {
313 permission java.security.AllPermission;
314 };
316 grant codeBase "file:/${file.reference.testng.jar}" {
317 permission java.security.AllPermission;
318 };
320 grant codeBase "file:/${basedir}/test/script/trusted/*" {
321 permission java.security.AllPermission;
322 };
324 grant codeBase "file:/${basedir}/test/script/maptests/*" {
325 permission java.io.FilePermission "${basedir}/test/script/maptests/*","read";
326 permission java.lang.RuntimePermission "nashorn.debugMode";
327 };
329 grant codeBase "file:/${basedir}/test/script/basic/*" {
330 permission java.io.FilePermission "${basedir}/test/script/-", "read";
331 permission java.io.FilePermission "$${user.dir}", "read";
332 permission java.util.PropertyPermission "user.dir", "read";
333 permission java.util.PropertyPermission "nashorn.test.*", "read";
334 };
336 grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
337 permission java.io.FilePermission "${basedir}/test/script/-", "read";
338 permission java.io.FilePermission "$${user.dir}", "read";
339 permission java.util.PropertyPermission "user.dir", "read";
340 permission java.util.PropertyPermission "nashorn.test.*", "read";
341 };
343 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
344 permission java.util.PropertyPermission "java.security.policy", "read";
345 };
347 grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
348 permission java.lang.RuntimePermission "nashorn.JavaReflection";
349 };
351 grant codeBase "file:/${basedir}/test/script/markdown.js" {
352 permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
353 };
355 </echo>
357 <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators -->
358 <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs -->
360 </target>
362 <target name="check-external-tests">
363 <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
364 <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
365 <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
366 <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
367 <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
368 <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
369 <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
370 <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
371 </target>
373 <target name="check-testng" unless="testng.available">
374 <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
375 </target>
377 <!-- only to be invoked as dependency of "test" target -->
378 <target name="-test-classes-all" depends="jar" unless="test.class">
379 <fileset id="test.classes" dir="${build.test.classes.dir}">
380 <include name="**/api/javaaccess/*Test.class"/>
381 <include name="**/api/scripting/*Test.class"/>
382 <include name="**/codegen/*Test.class"/>
383 <include name="**/parser/*Test.class"/>
384 <include name="**/runtime/*Test.class"/>
385 <include name="**/runtime/regexp/*Test.class"/>
386 <include name="**/runtime/regexp/joni/*Test.class"/>
387 <include name="**/framework/*Test.class"/>
388 </fileset>
389 </target>
391 <!-- only to be invoked as dependency of "test" target -->
392 <target name="-test-classes-single" depends="jar" if="test.class">
393 <fileset id="test.classes" dir="${build.test.classes.dir}">
394 <include name="${test.class}*"/>
395 </fileset>
396 </target>
398 <!-- only to be invoked as dependency of "test" target -->
399 <target name="-test-nosecurity" unless="test.class">
400 <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
401 <include name="**/framework/ScriptTest.class"/>
402 </fileset>
403 <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes"
404 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
405 <jvmarg line="${ext.class.path}"/>
406 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
407 <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
408 <propertyset>
409 <propertyref prefix="nashorn."/>
410 </propertyset>
411 <propertyset>
412 <propertyref prefix="test-sys-prop-no-security."/>
413 <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
414 </propertyset>
415 <classpath>
416 <pathelement path="${run.test.classpath}"/>
417 </classpath>
418 </testng>
419 </target>
421 <!-- only to be invoked as dependency of "test" target -->
422 <target name="-test-security">
423 <delete dir="${build.dir}/nashorn_code_cache"/>
424 <property name="debug.test.jvmargs" value=""/>
425 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
426 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
427 <jvmarg line="${ext.class.path}"/>
428 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
429 <jvmarg line="${debug.test.jvmargs}"/>
430 <propertyset>
431 <propertyref prefix="nashorn."/>
432 </propertyset>
433 <propertyset>
434 <propertyref prefix="test-sys-prop."/>
435 <mapper from="test-sys-prop.*" to="*" type="glob"/>
436 </propertyset>
437 <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
438 <classpath>
439 <pathelement path="${run.test.classpath}"/>
440 </classpath>
441 </testng>
442 </target>
444 <target name="test" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file, -test-security, -test-nosecurity" if="testng.available"/>
446 <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
447 <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy testng.jar, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar under test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
448 </target>
450 <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
451 <fileset id="test.classes" dir="${build.test.classes.dir}">
452 <include name="**/framework/*Test.class"/>
453 </fileset>
455 <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
457 <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
458 <not>
459 <os family="mac"/>
460 </not>
461 </condition>
463 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
464 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
465 <jvmarg line="${ext.class.path}"/>
466 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
467 <propertyset>
468 <propertyref prefix="testjfx-test-sys-prop."/>
469 <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
470 </propertyset>
471 <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
472 <classpath>
473 <pathelement path="${testjfx.run.test.classpath}"/>
474 </classpath>
475 </testng>
476 </target>
478 <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
479 <fileset id="test.classes" dir="${build.test.classes.dir}">
480 <include name="**/framework/*Test.class"/>
481 </fileset>
483 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
484 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
485 <jvmarg line="${ext.class.path}"/>
486 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
487 <propertyset>
488 <propertyref prefix="testmarkdown-test-sys-prop."/>
489 <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
490 </propertyset>
491 <classpath>
492 <pathelement path="${run.test.classpath}"/>
493 </classpath>
494 </testng>
495 </target>
497 <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
498 <fileset id="test.classes" dir="${build.test.classes.dir}">
499 <include name="**/framework/*Test.class"/>
500 </fileset>
502 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
503 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
504 <jvmarg line="${ext.class.path}"/>
505 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
506 <propertyset>
507 <propertyref prefix="nashorn."/>
508 </propertyset>
509 <propertyset>
510 <propertyref prefix="test262-test-sys-prop."/>
511 <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
512 </propertyset>
513 <classpath>
514 <pathelement path="${run.test.classpath}"/>
515 </classpath>
516 </testng>
517 </target>
519 <target name="test262parallel" depends="test262-parallel"/>
521 <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
522 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
523 <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
524 <jvmarg line="${ext.class.path}"/>
525 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
526 <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
527 <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
528 <classpath>
529 <pathelement path="${run.test.classpath}"/>
530 </classpath>
531 <syspropertyset>
532 <propertyref prefix="test262-test-sys-prop."/>
533 <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
534 </syspropertyset>
535 </java>
536 </target>
538 <target name="testparallel" depends="test-parallel"/>
540 <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
541 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
542 <java classname="${parallel.test.runner}" dir="${basedir}"
543 failonerror="true"
544 fork="true">
545 <jvmarg line="${ext.class.path}"/>
546 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
547 <classpath>
548 <pathelement path="${run.test.classpath}"/>
549 <pathelement path="${build.test.classes.dir}"/>
550 </classpath>
551 <syspropertyset>
552 <propertyref prefix="test-sys-prop."/>
553 <mapper type="glob" from="test-sys-prop.*" to="*"/>
554 </syspropertyset>
555 </java>
556 </target>
558 <target name="all" depends="test, docs"
559 description="Build, test and generate docs for nashorn"/>
561 <target name="run" depends="jar"
562 description="Run the shell with a sample script">
563 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
564 <jvmarg line="${ext.class.path}"/>
565 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
566 <arg value="-dump-on-error"/>
567 <arg value="test.js"/>
568 </java>
569 </target>
571 <target name="debug" depends="jar"
572 description="Debug the shell with a sample script">
573 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
574 <jvmarg line="${ext.class.path}"/>
575 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
576 <arg value="--print-code"/>
577 <arg value="--verify-code"/>
578 <arg value="--print-symbols"/>
579 <jvmarg value="-Dnashorn.codegen.debug=true"/>
580 <arg value="test.js"/>
581 </java>
582 </target>
584 <!-- targets to get external script tests -->
586 <!-- test262 test suite -->
587 <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
588 <!-- clone test262 git repo -->
589 <exec executable="${git.executable}">
590 <arg value="clone"/>
591 <arg value="--branch"/>
592 <arg value="es5-tests"/>
593 <arg value="https://github.com/tc39/test262"/>
594 <arg value="${test.external.dir}/test262"/>
595 </exec>
596 </target>
597 <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
598 <!-- update test262 git repo -->
599 <exec executable="${git.executable}" dir="${test.external.dir}/test262">
600 <arg value="pull"/>
601 </exec>
602 </target>
604 <!-- octane benchmark -->
605 <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
606 <!-- checkout octane benchmarks -->
607 <exec executable="${svn.executable}">
608 <arg value="--non-interactive"/>
609 <arg value="--trust-server-cert"/>
610 <arg value="checkout"/>
611 <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
612 <arg value="${test.external.dir}/octane"/>
613 </exec>
614 </target>
615 <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
616 <!-- update octane benchmarks -->
617 <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
618 <arg value="--non-interactive"/>
619 <arg value="--trust-server-cert"/>
620 <arg value="update"/>
621 </exec>
622 </target>
624 <!-- sunspider benchmark -->
625 <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
626 <!-- checkout sunspider -->
627 <exec executable="${svn.executable}">
628 <arg value="--non-interactive"/>
629 <arg value="--trust-server-cert"/>
630 <arg value="checkout"/>
631 <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
632 <arg value="${test.external.dir}/sunspider"/>
633 </exec>
634 </target>
635 <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
636 <!-- update sunspider -->
637 <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
638 <arg value="--non-interactive"/>
639 <arg value="--trust-server-cert"/>
640 <arg value="update"/>
641 </exec>
642 </target>
644 <!-- get all external test scripts -->
645 <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
646 <!-- make external test dir -->
647 <mkdir dir="${test.external.dir}"/>
649 <!-- jquery -->
650 <mkdir dir="${test.external.dir}/jquery"/>
651 <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
652 <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
654 <!-- prototype -->
655 <mkdir dir="${test.external.dir}/prototype"/>
656 <get src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0/prototype.js" dest="${test.external.dir}/prototype" usetimestamp="true" skipexisting="true" ignoreerrors="true"/>
658 <!-- underscorejs -->
659 <mkdir dir="${test.external.dir}/underscore"/>
660 <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
661 <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
663 <!-- yui -->
664 <mkdir dir="${test.external.dir}/yui"/>
665 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
666 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
668 <!-- showdown -->
669 <mkdir dir="${test.external.dir}/showdown"/>
670 <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
671 <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
673 </target>
675 <!-- update external test suites that are pulled from source control systems -->
676 <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
678 <!-- run all perf tests -->
679 <target name="perf" depends="externals, update-externals, sunspider, octane"/>
681 <!-- run all tests -->
682 <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
683 <fail message="Exiting.."/>
684 </target>
686 <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
688 <import file="build-benchmark.xml"/>
690 </project>