Tue, 14 Oct 2014 13:04:56 +0200
8060238: Reports for optimistic test run overwrite those for pessimistic run
Reviewed-by: hannesw, lagergren, sundar
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/es6/*" {
344 permission java.io.FilePermission "${basedir}/test/script/-", "read";
345 permission java.io.FilePermission "$${user.dir}", "read";
346 permission java.util.PropertyPermission "user.dir", "read";
347 permission java.util.PropertyPermission "nashorn.test.*", "read";
348 };
350 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
351 permission java.util.PropertyPermission "java.security.policy", "read";
352 };
354 grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
355 permission java.lang.RuntimePermission "nashorn.JavaReflection";
356 };
358 grant codeBase "file:/${basedir}/test/script/markdown.js" {
359 permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
360 };
362 </echo>
364 <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators -->
365 <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs -->
367 </target>
369 <target name="check-external-tests">
370 <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
371 <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
372 <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
373 <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
374 <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
375 <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
376 <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
377 <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
378 </target>
380 <target name="check-testng" unless="testng.available">
381 <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
382 </target>
384 <!-- only to be invoked as dependency of "test" target -->
385 <target name="-test-classes-all" depends="jar" unless="test.class">
386 <fileset id="test.classes" dir="${build.test.classes.dir}">
387 <include name="**/api/javaaccess/*Test.class"/>
388 <include name="**/api/scripting/*Test.class"/>
389 <include name="**/codegen/*Test.class"/>
390 <include name="**/parser/*Test.class"/>
391 <include name="**/runtime/*Test.class"/>
392 <include name="**/runtime/regexp/*Test.class"/>
393 <include name="**/runtime/regexp/joni/*Test.class"/>
394 <include name="**/framework/*Test.class"/>
395 </fileset>
396 </target>
398 <!-- only to be invoked as dependency of "test" target -->
399 <target name="-test-classes-single" depends="jar" if="test.class">
400 <fileset id="test.classes" dir="${build.test.classes.dir}">
401 <include name="${test.class}*"/>
402 </fileset>
403 </target>
405 <!-- only to be invoked as dependency of "test" target -->
406 <target name="-test-nosecurity" unless="test.class">
407 <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
408 <include name="**/framework/ScriptTest.class"/>
409 </fileset>
410 <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
411 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
412 <jvmarg line="${ext.class.path}"/>
413 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
414 <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
415 <propertyset>
416 <propertyref prefix="nashorn."/>
417 </propertyset>
418 <propertyset>
419 <propertyref prefix="test-sys-prop-no-security."/>
420 <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
421 </propertyset>
422 <sysproperty key="optimistic.override" value="${optimistic}"/>
423 <classpath>
424 <pathelement path="${run.test.classpath}"/>
425 </classpath>
426 </testng>
427 </target>
429 <!-- only to be invoked as dependency of "test" target -->
430 <target name="-test-security">
431 <delete dir="${build.dir}/nashorn_code_cache"/>
432 <property name="debug.test.jvmargs" value=""/>
433 <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.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} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
437 <jvmarg line="${debug.test.jvmargs}"/>
438 <propertyset>
439 <propertyref prefix="nashorn."/>
440 </propertyset>
441 <propertyset>
442 <propertyref prefix="test-sys-prop."/>
443 <mapper from="test-sys-prop.*" to="*" type="glob"/>
444 </propertyset>
445 <sysproperty key="optimistic.override" value="${optimistic}"/>
446 <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
447 <classpath>
448 <pathelement path="${run.test.classpath}"/>
449 </classpath>
450 </testng>
451 </target>
453 <target name="test" depends="test-pessimistic, test-optimistic"/>
455 <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">
456 <echo message="Running test suite in OPTIMISTIC mode..."/>
457 <antcall target="-test-nosecurity" inheritRefs="true">
458 <param name="optimistic" value="true"/>
459 <param name="testResultsSubDir" value="optimistic"/>
460 </antcall>
461 <antcall target="-test-security" inheritRefs="true">
462 <param name="optimistic" value="true"/>
463 <param name="testResultsSubDir" value="optimistic"/>
464 </antcall>
465 </target>
467 <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">
468 <echo message="Running test suite in PESSIMISTIC mode..."/>
469 <antcall target="-test-nosecurity" inheritRefs="true">
470 <param name="optimistic" value="false"/>
471 <param name="testResultsSubDir" value="pessimistic"/>
472 </antcall>
473 <antcall target="-test-security" inheritRefs="true">
474 <param name="optimistic" value="false"/>
475 <param name="testResultsSubDir" value="pessimistic"/>
476 </antcall>
477 </target>
479 <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
480 <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."/>
481 </target>
483 <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
484 <fileset id="test.classes" dir="${build.test.classes.dir}">
485 <include name="**/framework/*Test.class"/>
486 </fileset>
488 <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
490 <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
491 <not>
492 <os family="mac"/>
493 </not>
494 </condition>
496 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
497 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
498 <jvmarg line="${ext.class.path}"/>
499 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
500 <propertyset>
501 <propertyref prefix="testjfx-test-sys-prop."/>
502 <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
503 </propertyset>
504 <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
505 <classpath>
506 <pathelement path="${testjfx.run.test.classpath}"/>
507 </classpath>
508 </testng>
509 </target>
511 <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
512 <fileset id="test.classes" dir="${build.test.classes.dir}">
513 <include name="**/framework/*Test.class"/>
514 </fileset>
516 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
517 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
518 <jvmarg line="${ext.class.path}"/>
519 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
520 <propertyset>
521 <propertyref prefix="testmarkdown-test-sys-prop."/>
522 <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
523 </propertyset>
524 <classpath>
525 <pathelement path="${run.test.classpath}"/>
526 </classpath>
527 </testng>
528 </target>
530 <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
531 <fileset id="test.classes" dir="${build.test.classes.dir}">
532 <include name="**/framework/*Test.class"/>
533 </fileset>
535 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
536 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
537 <jvmarg line="${ext.class.path}"/>
538 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
539 <propertyset>
540 <propertyref prefix="nashorn."/>
541 </propertyset>
542 <propertyset>
543 <propertyref prefix="test262-test-sys-prop."/>
544 <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
545 </propertyset>
546 <classpath>
547 <pathelement path="${run.test.classpath}"/>
548 </classpath>
549 </testng>
550 </target>
552 <target name="test262parallel" depends="test262-parallel"/>
554 <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
555 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
556 <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
557 <jvmarg line="${ext.class.path}"/>
558 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
559 <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
560 <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
561 <classpath>
562 <pathelement path="${run.test.classpath}"/>
563 </classpath>
564 <syspropertyset>
565 <propertyref prefix="test262-test-sys-prop."/>
566 <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
567 </syspropertyset>
568 </java>
569 </target>
571 <target name="testparallel" depends="test-parallel"/>
573 <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
574 <!-- use just build.test.classes.dir to avoid referring to TestNG -->
575 <java classname="${parallel.test.runner}" dir="${basedir}"
576 failonerror="true"
577 fork="true">
578 <jvmarg line="${ext.class.path}"/>
579 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
580 <classpath>
581 <pathelement path="${run.test.classpath}"/>
582 <pathelement path="${build.test.classes.dir}"/>
583 </classpath>
584 <syspropertyset>
585 <propertyref prefix="test-sys-prop."/>
586 <mapper type="glob" from="test-sys-prop.*" to="*"/>
587 </syspropertyset>
588 </java>
589 </target>
591 <target name="all" depends="test, docs"
592 description="Build, test and generate docs for nashorn"/>
594 <target name="run" depends="jar"
595 description="Run the shell with a sample script">
596 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
597 <jvmarg line="${ext.class.path}"/>
598 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
599 <arg value="-dump-on-error"/>
600 <arg value="test.js"/>
601 </java>
602 </target>
604 <target name="debug" depends="jar"
605 description="Debug the shell with a sample script">
606 <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
607 <jvmarg line="${ext.class.path}"/>
608 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
609 <arg value="--print-code"/>
610 <arg value="--verify-code"/>
611 <arg value="--print-symbols"/>
612 <jvmarg value="-Dnashorn.codegen.debug=true"/>
613 <arg value="test.js"/>
614 </java>
615 </target>
617 <!-- targets to get external script tests -->
619 <!-- test262 test suite -->
620 <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
621 <!-- clone test262 git repo -->
622 <exec executable="${git.executable}">
623 <arg value="clone"/>
624 <arg value="--branch"/>
625 <arg value="es5-tests"/>
626 <arg value="https://github.com/tc39/test262"/>
627 <arg value="${test.external.dir}/test262"/>
628 </exec>
629 </target>
630 <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
631 <!-- update test262 git repo -->
632 <exec executable="${git.executable}" dir="${test.external.dir}/test262">
633 <arg value="pull"/>
634 </exec>
635 </target>
637 <!-- octane benchmark -->
638 <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
639 <!-- checkout octane benchmarks -->
640 <exec executable="${svn.executable}">
641 <arg value="--non-interactive"/>
642 <arg value="--trust-server-cert"/>
643 <arg value="checkout"/>
644 <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
645 <arg value="${test.external.dir}/octane"/>
646 </exec>
647 </target>
648 <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
649 <!-- update octane benchmarks -->
650 <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
651 <arg value="--non-interactive"/>
652 <arg value="--trust-server-cert"/>
653 <arg value="update"/>
654 </exec>
655 </target>
657 <!-- sunspider benchmark -->
658 <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
659 <!-- checkout sunspider -->
660 <exec executable="${svn.executable}">
661 <arg value="--non-interactive"/>
662 <arg value="--trust-server-cert"/>
663 <arg value="checkout"/>
664 <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
665 <arg value="${test.external.dir}/sunspider"/>
666 </exec>
667 </target>
668 <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
669 <!-- update sunspider -->
670 <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
671 <arg value="--non-interactive"/>
672 <arg value="--trust-server-cert"/>
673 <arg value="update"/>
674 </exec>
675 </target>
677 <!-- get all external test scripts -->
678 <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
679 <!-- make external test dir -->
680 <mkdir dir="${test.external.dir}"/>
682 <!-- jquery -->
683 <mkdir dir="${test.external.dir}/jquery"/>
684 <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
685 <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
687 <!-- prototype -->
688 <mkdir dir="${test.external.dir}/prototype"/>
689 <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"/>
691 <!-- underscorejs -->
692 <mkdir dir="${test.external.dir}/underscore"/>
693 <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
694 <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
696 <!-- yui -->
697 <mkdir dir="${test.external.dir}/yui"/>
698 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
699 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
701 <!-- showdown -->
702 <mkdir dir="${test.external.dir}/showdown"/>
703 <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
704 <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
706 </target>
708 <!-- update external test suites that are pulled from source control systems -->
709 <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
711 <!-- run all perf tests -->
712 <target name="perf" depends="externals, update-externals, sunspider, octane"/>
714 <!-- run all tests -->
715 <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
716 <fail message="Exiting.."/>
717 </target>
719 <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
721 <import file="build-benchmark.xml"/>
723 </project>