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