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