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