Mon, 23 May 2016 09:25:36 +0200
8157444: exclude jjs shebang handling test from runs
Reviewed-by: sundar, hannesw, jlaskey
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!--
4 Copyright (c) 2010, 2015, 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 TestNG and dependencies are available, and download them if they aren't -->
53 <antcall target="get-testng"/>
54 <condition property="testng.available" value="true">
55 <and>
56 <available file="${file.reference.testng.jar}"/>
57 <available file="${file.reference.jcommander.jar}"/>
58 <available file="${file.reference.bsh.jar}"/>
59 <available file="${file.reference.snakeyaml.jar}"/>
60 </and>
61 </condition>
62 <!-- check if Jemmy ang TestNG are avaiable -->
63 <condition property="jemmy.jfx.testng.available" value="true">
64 <and>
65 <available file="${file.reference.jemmyfx.jar}"/>
66 <available file="${file.reference.jemmycore.jar}"/>
67 <available file="${file.reference.jemmyawtinput.jar}"/>
68 <available file="${file.reference.jfxrt.jar}"/>
69 <isset property="testng.available"/>
70 </and>
71 </condition>
73 <!-- enable/disable make code coverage -->
74 <condition property="cc.enabled">
75 <istrue value="${make.code.coverage}" />
76 </condition>
78 <!-- exclude tests in exclude lists -->
79 <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt">
80 <istrue value="${make.code.coverage}" />
81 </condition>
83 <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
84 <istrue value="${jfr}"/>
85 </condition>
87 <condition property="test-sys-prop-no-security.os.not.windows">
88 <not>
89 <os family="windows"/>
90 </not>
91 </condition>
92 </target>
94 <!-- check minimum ant version required to be 1.8.4 -->
95 <target name="check-ant-version">
96 <property name="ant.version.required" value="1.8.4"/>
97 <antversion property="ant.current.version" />
98 <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.8.4 or above.">
99 <condition>
100 <not>
101 <antversion atleast="${ant.version.required}"/>
102 </not>
103 </condition>
104 </fail>
105 </target>
107 <target name="check-java-version">
108 <!-- look for a Class that is available only in jdk1.8 or above -->
109 <!-- core/exposed API class is better than an implementation class -->
110 <available property="jdk1.8+" classname="java.util.stream.Stream"/>
112 <!-- need jdk1.8 or above -->
113 <fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+">
114 </fail>
115 </target>
117 <target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc">
118 <!-- extends jvm args -->
119 <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
120 <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
122 <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
123 <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
124 <echo message="run.test.xms=${run.test.xms}"/>
125 <echo message="run.test.xmx=${run.test.xmx}"/>
127 </target>
129 <target name="prepare" depends="init">
130 <mkdir dir="${build.dir}"/>
131 <mkdir dir="${build.classes.dir}"/>
132 <mkdir dir="${build.classes.dir}/META-INF/services"/>
133 <mkdir dir="${build.test.classes.dir}"/>
134 <mkdir dir="${dist.dir}"/>
135 <mkdir dir="${dist.javadoc.dir}"/>
136 </target>
138 <target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
139 <delete includeemptydirs="true">
140 <fileset dir="${build.dir}" erroronmissingdir="false"/>
141 </delete>
142 <delete dir="${dist.dir}"/>
143 </target>
145 <target name="compile" depends="prepare" description="Compiles nashorn">
146 <javac srcdir="${src.dir}"
147 destdir="${build.classes.dir}"
148 classpath="${javac.classpath}"
149 source="${javac.source}"
150 target="${javac.target}"
151 debug="${javac.debug}"
152 encoding="${javac.encoding}"
153 includeantruntime="false" fork="true">
154 <compilerarg value="-J-Djava.ext.dirs="/>
155 <compilerarg value="-Xlint:all"/>
156 <compilerarg value="-XDignore.symbol.file"/>
157 <compilerarg value="-Xdiags:verbose"/>
158 </javac>
159 <copy todir="${build.classes.dir}/META-INF/services">
160 <fileset dir="${meta.inf.dir}/services/"/>
161 </copy>
162 <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
163 <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
164 </copy>
165 <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
166 <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
167 </copy>
168 <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
169 <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
170 </copy>
171 <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
172 <copy file="${src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${build.classes.dir}/jdk/nashorn/internal/codegen"/>
174 <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
175 <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
176 <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
177 </target>
179 <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
180 <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
181 <fileset dir="${build.classes.dir}"/>
182 <manifest>
183 <attribute name="Archiver-Version" value="n/a"/>
184 <attribute name="Build-Jdk" value="${java.runtime.version}"/>
185 <attribute name="Built-By" value="n/a"/>
186 <attribute name="Created-By" value="Ant jar task"/>
187 <section name="jdk/nashorn/">
188 <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
189 <attribute name="Implementation-Version" value="${nashorn.version}"/>
190 </section>
191 </manifest>
192 </jar>
193 </target>
195 <target name="use-promoted-nashorn" depends="init">
196 <delete file="${dist.dir}/nashorn.jar"/>
197 <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
198 <property name="compile.suppress.jar" value="defined"/>
199 </target>
201 <target name="build-fxshell" depends="jar">
202 <description>Builds the javafx shell.</description>
203 <mkdir dir="${fxshell.classes.dir}"/>
204 <javac srcdir="${fxshell.dir}"
205 destdir="${fxshell.classes.dir}"
206 classpath="${dist.jar}${path.separator}${javac.classpath}"
207 debug="${javac.debug}"
208 encoding="${javac.encoding}"
209 includeantruntime="false">
210 </javac>
211 <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
212 <fileset dir="${fxshell.classes.dir}"/>
213 <manifest>
214 <attribute name="Archiver-Version" value="n/a"/>
215 <attribute name="Build-Jdk" value="${java.runtime.version}"/>
216 <attribute name="Built-By" value="n/a"/>
217 <attribute name="Created-By" value="Ant jar task"/>
218 <section name="jdk/nashorn/">
219 <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/>
220 <attribute name="Implementation-Version" value="${nashorn.version}"/>
221 </section>
222 </manifest>
223 </jar>
224 </target>
226 <!-- generate javadoc for all Nashorn and ASM classes -->
227 <target name="javadoc" depends="jar">
228 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
229 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
230 additionalparam="-quiet" failonerror="true" useexternalfile="true">
231 <arg value="${javadoc.option}"/>
232 <classpath>
233 <pathelement location="${build.classes.dir}"/>
234 </classpath>
235 <fileset dir="${src.dir}" includes="**/*.java"/>
236 <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
237 <link href="http://docs.oracle.com/javase/8/docs/api/"/>
238 <!-- The following tags are used only in ASM sources - just ignore these -->
239 <tag name="label" description="label tag in ASM sources" enabled="false"/>
240 <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
241 <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
242 </javadoc>
243 </target>
245 <!-- generate javadoc for Nashorn classes -->
246 <target name="javadocnh" depends="jar">
247 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${src.dir}/overview.html"
248 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
249 additionalparam="-quiet" failonerror="true" useexternalfile="true">
250 <arg value="${javadoc.option}"/>
251 <classpath>
252 <pathelement location="${build.classes.dir}"/>
253 </classpath>
254 <fileset dir="${src.dir}" includes="**/*.java"/>
255 <link href="http://docs.oracle.com/javase/8/docs/api/"/>
256 </javadoc>
257 </target>
259 <!-- generate javadoc only for nashorn extension api classes -->
260 <target name="javadocapi" depends="jar">
261 <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}"
262 windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true" useexternalfile="true">
263 <arg value="${javadoc.option}"/>
264 <classpath>
265 <pathelement location="${build.classes.dir}"/>
266 </classpath>
267 <fileset dir="${src.dir}" includes="jdk/nashorn/api/**/*.java"/>
268 <link href="http://docs.oracle.com/javase/8/docs/api/"/>
269 </javadoc>
270 </target>
272 <!-- generate shell.html for shell tool documentation -->
273 <target name="shelldoc" depends="jar">
274 <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
275 <jvmarg line="${ext.class.path}"/>
276 <arg value="-scripting"/>
277 <arg value="docs/genshelldoc.js"/>
278 </java>
279 </target>
281 <!-- generate all docs -->
282 <target name="docs" depends="javadoc, shelldoc"/>
284 <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
285 <target name="dist" depends="jar">
286 <zip destfile="${build.zip}" basedir=".."
287 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
288 <tar destfile="${build.gzip}" basedir=".." compression="gzip"
289 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
290 </target>
292 <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
293 <!-- testng task -->
294 <taskdef name="testng" classname="org.testng.TestNGAntTask"
295 classpath="${testng.ant.classpath}"/>
297 <javac srcdir="${test.src.dir}"
298 destdir="${build.test.classes.dir}"
299 classpath="${javac.test.classpath}"
300 source="${test.javac.source}"
301 target="${test.javac.target}"
302 debug="${javac.debug}"
303 encoding="${javac.encoding}"
304 includeantruntime="false" fork="true">
305 <compilerarg value="-J-Djava.ext.dirs="/>
306 <compilerarg value="-Xlint:unchecked"/>
307 <compilerarg value="-Xlint:deprecation"/>
308 <compilerarg value="-Xdiags:verbose"/>
309 </javac>
311 <copy todir="${build.test.classes.dir}/META-INF/services">
312 <fileset dir="${test.src.dir}/META-INF/services/"/>
313 </copy>
315 <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/test/resources">
316 <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/test/resources"/>
317 </copy>
319 <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/test/resources">
320 <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/test/resources"/>
321 </copy>
323 <!-- tests that check nashorn internals and internal API -->
324 <jar jarfile="${nashorn.internal.tests.jar}">
325 <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
326 </jar>
328 <!-- tests that check nashorn script engine (jsr-223) API -->
329 <jar jarfile="${nashorn.api.tests.jar}">
330 <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
331 <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
332 <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
333 </jar>
335 </target>
337 <target name="generate-policy-file" depends="prepare">
338 <echo file="${build.dir}/nashorn.policy">
340 grant codeBase "file:/${toString:dist.path}/nashorn.jar" {
341 permission java.security.AllPermission;
342 };
344 grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
345 permission java.security.AllPermission;
346 };
348 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
349 permission java.security.AllPermission;
350 };
351 grant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
352 permission java.security.AllPermission;
353 };
354 grant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
355 permission java.security.AllPermission;
356 };
357 grant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
358 permission java.security.AllPermission;
359 };
360 //// in case of absolute path:
361 grant codeBase "file:/${nashorn.internal.tests.jar}" {
362 permission java.security.AllPermission;
363 };
365 grant codeBase "file:/${file.reference.testng.jar}" {
366 permission java.security.AllPermission;
367 };
368 grant codeBase "file:/${file.reference.jcommander.jar}" {
369 permission java.security.AllPermission;
370 };
371 grant codeBase "file:/${file.reference.bsh.jar}" {
372 permission java.security.AllPermission;
373 };
374 grant codeBase "file:/${file.reference.snakeyaml.jar}" {
375 permission java.security.AllPermission;
376 };
379 grant codeBase "file:/${basedir}/test/script/trusted/*" {
380 permission java.security.AllPermission;
381 };
383 grant codeBase "file:/${basedir}/test/script/maptests/*" {
384 permission java.io.FilePermission "${basedir}/test/script/maptests/*","read";
385 permission java.lang.RuntimePermission "nashorn.debugMode";
386 };
388 grant codeBase "file:/${basedir}/test/script/basic/*" {
389 permission java.io.FilePermission "${basedir}/test/script/-", "read";
390 permission java.io.FilePermission "$${user.dir}", "read";
391 permission java.util.PropertyPermission "user.dir", "read";
392 permission java.util.PropertyPermission "nashorn.test.*", "read";
393 };
395 grant codeBase "file:/${basedir}/test/script/basic/apply_to_call/*" {
396 permission java.io.FilePermission "${basedir}/test/script/-", "read";
397 permission java.io.FilePermission "$${user.dir}", "read";
398 permission java.util.PropertyPermission "user.dir", "read";
399 permission java.util.PropertyPermission "nashorn.test.*", "read";
400 };
402 grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
403 permission java.io.FilePermission "${basedir}/test/script/-", "read";
404 permission java.io.FilePermission "$${user.dir}", "read";
405 permission java.util.PropertyPermission "user.dir", "read";
406 permission java.util.PropertyPermission "nashorn.test.*", "read";
407 };
409 grant codeBase "file:/${basedir}/test/script/basic/es6/*" {
410 permission java.io.FilePermission "${basedir}/test/script/-", "read";
411 permission java.io.FilePermission "$${user.dir}", "read";
412 permission java.util.PropertyPermission "user.dir", "read";
413 permission java.util.PropertyPermission "nashorn.test.*", "read";
414 };
416 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
417 permission java.util.PropertyPermission "java.security.policy", "read";
418 };
420 grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
421 permission java.lang.RuntimePermission "nashorn.JavaReflection";
422 };
424 grant codeBase "file:/${basedir}/test/script/markdown.js" {
425 permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
426 };
428 </echo>
430 <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators -->
431 <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs -->
433 </target>
435 <target name="check-external-tests">
436 <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
437 <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
438 <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
439 <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
440 <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
441 <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
442 <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
443 <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
444 </target>
446 <target name="check-testng" unless="testng.available">
447 <echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
448 </target>
450 <!-- only to be invoked as dependency of "test" target -->
451 <target name="-test-classes-all" depends="jar" unless="test.class">
452 <fileset id="test.classes" dir="${build.test.classes.dir}">
453 <include name="**/api/javaaccess/test/*Test.class"/>
454 <include name="**/api/scripting/test/*Test.class"/>
455 <include name="**/codegen/test/*Test.class"/>
456 <include name="**/parser/test/*Test.class"/>
457 <include name="**/runtime/test/*Test.class"/>
458 <include name="**/runtime/regexp/test/*Test.class"/>
459 <include name="**/runtime/regexp/joni/test/*Test.class"/>
460 <include name="**/framework/*Test.class"/>
461 </fileset>
462 </target>
464 <!-- only to be invoked as dependency of "test" target -->
465 <target name="-test-classes-single" depends="jar" if="test.class">
466 <fileset id="test.classes" dir="${build.test.classes.dir}">
467 <include name="${test.class}*"/>
468 </fileset>
469 </target>
471 <!-- only to be invoked as dependency of "test" target -->
472 <target name="-test-nosecurity" unless="test.class">
473 <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
474 <include name="**/framework/ScriptTest.class"/>
475 </fileset>
476 <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
477 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
478 <jvmarg line="${ext.class.path}"/>
479 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
480 <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
481 <propertyset>
482 <propertyref prefix="nashorn."/>
483 </propertyset>
484 <propertyset>
485 <propertyref prefix="test-sys-prop-no-security."/>
486 <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
487 </propertyset>
488 <sysproperty key="optimistic.override" value="${optimistic}"/>
489 <classpath>
490 <pathelement path="${run.test.classpath}"/>
491 </classpath>
492 </testng>
493 </target>
495 <!-- only to be invoked as dependency of "test" target -->
496 <target name="-test-security">
497 <delete dir="${build.dir}/nashorn_code_cache"/>
498 <property name="debug.test.jvmargs" value=""/>
499 <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
500 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
501 <jvmarg line="${ext.class.path}"/>
502 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
503 <jvmarg line="${debug.test.jvmargs}"/>
504 <propertyset>
505 <propertyref prefix="nashorn."/>
506 </propertyset>
507 <propertyset>
508 <propertyref prefix="test-sys-prop."/>
509 <mapper from="test-sys-prop.*" to="*" type="glob"/>
510 </propertyset>
511 <sysproperty key="optimistic.override" value="${optimistic}"/>
512 <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
513 <classpath>
514 <pathelement path="${run.test.classpath}"/>
515 </classpath>
516 </testng>
517 </target>
519 <target name="test" depends="prepare, javadocnh, test-pessimistic, test-optimistic"/>
521 <target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
522 <echo message="Running test suite in OPTIMISTIC mode..."/>
523 <antcall target="-test-nosecurity" inheritRefs="true">
524 <param name="optimistic" value="true"/>
525 <param name="testResultsSubDir" value="optimistic"/>
526 </antcall>
527 <antcall target="-test-security" inheritRefs="true">
528 <param name="optimistic" value="true"/>
529 <param name="testResultsSubDir" value="optimistic"/>
530 </antcall>
531 </target>
533 <target name="test-pessimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
534 <echo message="Running test suite in PESSIMISTIC mode..."/>
535 <antcall target="-test-nosecurity" inheritRefs="true">
536 <param name="optimistic" value="false"/>
537 <param name="testResultsSubDir" value="pessimistic"/>
538 </antcall>
539 <antcall target="-test-security" inheritRefs="true">
540 <param name="optimistic" value="false"/>
541 <param name="testResultsSubDir" value="pessimistic"/>
542 </antcall>
543 </target>
545 <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
546 <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy TestNG and dependency JARs, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar to the test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
547 </target>
549 <target name="testjfx" depends="jar, get-testng, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
550 <fileset id="test.classes" dir="${build.test.classes.dir}">
551 <include name="**/framework/*Test.class"/>
552 </fileset>
554 <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
556 <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
557 <not>
558 <os family="mac"/>
559 </not>
560 </condition>
562 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
563 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
564 <jvmarg line="${ext.class.path}"/>
565 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
566 <propertyset>
567 <propertyref prefix="testjfx-test-sys-prop."/>
568 <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
569 </propertyset>
570 <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
571 <classpath>
572 <pathelement path="${testjfx.run.test.classpath}"/>
573 </classpath>
574 </testng>
575 </target>
577 <target name="testmarkdown" depends="jar, get-testng, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
578 <fileset id="test.classes" dir="${build.test.classes.dir}">
579 <include name="**/framework/*Test.class"/>
580 </fileset>
582 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
583 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
584 <jvmarg line="${ext.class.path}"/>
585 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
586 <propertyset>
587 <propertyref prefix="testmarkdown-test-sys-prop."/>
588 <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
589 </propertyset>
590 <classpath>
591 <pathelement path="${run.test.classpath}"/>
592 </classpath>
593 </testng>
594 </target>
596 <target name="test262" depends="jar, get-testng, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
597 <fileset id="test.classes" dir="${build.test.classes.dir}">
598 <include name="**/framework/*Test.class"/>
599 </fileset>
601 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
602 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
603 <jvmarg line="${ext.class.path}"/>
604 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
605 <propertyset>
606 <propertyref prefix="nashorn."/>
607 </propertyset>
608 <propertyset>
609 <propertyref prefix="test262-test-sys-prop."/>
610 <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
611 </propertyset>
612 <classpath>
613 <pathelement path="${run.test.classpath}"/>
614 </classpath>
615 </testng>
616 </target>
618 <target name="test262parallel" depends="test262-parallel"/>
620 <target name="test262-parallel" depends="jar, get-testng, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
621 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
622 <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
623 <jvmarg line="${ext.class.path}"/>
624 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
625 <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
626 <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
627 <classpath>
628 <pathelement path="${run.test.classpath}"/>
629 </classpath>
630 <syspropertyset>
631 <propertyref prefix="test262-test-sys-prop."/>
632 <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
633 </syspropertyset>
634 </java>
635 </target>
637 <target name="testparallel" depends="test-parallel"/>
639 <target name="test-parallel" depends="jar, get-testng, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
640 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
641 <java classname="${parallel.test.runner}" dir="${basedir}"
642 failonerror="true"
643 fork="true">
644 <jvmarg line="${ext.class.path}"/>
645 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
646 <classpath>
647 <pathelement path="${run.test.classpath}"/>
648 <pathelement path="${build.test.classes.dir}"/>
649 </classpath>
650 <syspropertyset>
651 <propertyref prefix="test-sys-prop."/>
652 <mapper type="glob" from="test-sys-prop.*" to="*"/>
653 </syspropertyset>
654 </java>
655 </target>
657 <target name="all" depends="test, docs"
658 description="Build, test and generate docs for nashorn"/>
660 <target name="run" depends="jar"
661 description="Run the shell with a sample script">
662 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
663 <jvmarg line="${ext.class.path}"/>
664 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
665 <arg value="-dump-on-error"/>
666 <arg value="test.js"/>
667 </java>
668 </target>
670 <target name="debug" depends="jar"
671 description="Debug the shell with a sample script">
672 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
673 <jvmarg line="${ext.class.path}"/>
674 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
675 <arg value="--print-code"/>
676 <arg value="--verify-code"/>
677 <arg value="--print-symbols"/>
678 <jvmarg value="-Dnashorn.codegen.debug=true"/>
679 <arg value="test.js"/>
680 </java>
681 </target>
683 <!-- targets to get external script tests -->
685 <!-- test262 test suite -->
686 <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
687 <!-- clone test262 git repo -->
688 <exec executable="${git.executable}">
689 <arg value="clone"/>
690 <arg value="--branch"/>
691 <arg value="es5-tests"/>
692 <arg value="https://github.com/tc39/test262"/>
693 <arg value="${test.external.dir}/test262"/>
694 </exec>
695 </target>
696 <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
697 <!-- update test262 git repo -->
698 <exec executable="${git.executable}" dir="${test.external.dir}/test262">
699 <arg value="pull"/>
700 </exec>
701 </target>
703 <!-- octane benchmark -->
704 <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
705 <!-- checkout octane benchmarks -->
706 <exec executable="${svn.executable}">
707 <arg value="--non-interactive"/>
708 <arg value="--trust-server-cert"/>
709 <arg value="checkout"/>
710 <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
711 <arg value="${test.external.dir}/octane"/>
712 </exec>
713 </target>
714 <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
715 <!-- update octane benchmarks -->
716 <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
717 <arg value="--non-interactive"/>
718 <arg value="--trust-server-cert"/>
719 <arg value="update"/>
720 </exec>
721 </target>
723 <!-- sunspider benchmark -->
724 <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
725 <!-- checkout sunspider -->
726 <exec executable="${svn.executable}">
727 <arg value="--non-interactive"/>
728 <arg value="--trust-server-cert"/>
729 <arg value="checkout"/>
730 <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
731 <arg value="${test.external.dir}/sunspider"/>
732 </exec>
733 </target>
734 <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
735 <!-- update sunspider -->
736 <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
737 <arg value="--non-interactive"/>
738 <arg value="--trust-server-cert"/>
739 <arg value="update"/>
740 </exec>
741 </target>
743 <!-- get all external test scripts -->
744 <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider, get-testng">
745 <!-- make external test dir -->
746 <mkdir dir="${test.external.dir}"/>
748 <!-- jquery -->
749 <mkdir dir="${test.external.dir}/jquery"/>
750 <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
751 <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
753 <!-- prototype -->
754 <mkdir dir="${test.external.dir}/prototype"/>
755 <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"/>
757 <!-- underscorejs -->
758 <mkdir dir="${test.external.dir}/underscore"/>
759 <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
760 <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
762 <!-- yui -->
763 <mkdir dir="${test.external.dir}/yui"/>
764 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
765 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
767 <!-- showdown -->
768 <mkdir dir="${test.external.dir}/showdown"/>
769 <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
770 <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
772 </target>
774 <!-- update external test suites that are pulled from source control systems -->
775 <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
777 <!-- run all perf tests -->
778 <target name="perf" depends="externals, update-externals, sunspider, octane"/>
780 <!-- download and install testng.jar -->
781 <target name="get-testng">
782 <get dest="${test.lib}" skipexisting="true">
783 <url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
784 <url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
785 <url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
786 <url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
787 </get>
788 </target>
790 <!-- run all tests -->
791 <target name="alltests" depends="get-testng, externals, update-externals, test, test262parallel, testmarkdown, perf"/>
793 <import file="build-benchmark.xml"/>
795 </project>