make/build.xml

Thu, 09 Oct 2014 10:19:24 +0200

author
lagergren
date
Thu, 09 Oct 2014 10:19:24 +0200
changeset 1036
8a99ee1fb375
parent 991
b7a2db4de254
child 1055
3736ebef15e9
permissions
-rw-r--r--

8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
Reviewed-by: attila, shade, hannesw

     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=&quot;${toString:nashorn.ext.path}&quot;"/>
    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}" 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}" 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     </antcall>    
   460     <antcall target="-test-security" inheritRefs="true">
   461       <param name="optimistic" value="true"/>
   462     </antcall>
   463   </target>
   465   <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">
   466     <echo message="Running test suite in PESSIMISTIC mode..."/>
   467     <antcall target="-test-nosecurity" inheritRefs="true">
   468       <param name="optimistic" value="false"/>
   469     </antcall>    
   470     <antcall target="-test-security" inheritRefs="true">
   471       <param name="optimistic" value="false"/>
   472     </antcall>
   473   </target>
   475   <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
   476     <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."/>
   477   </target>
   479   <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
   480     <fileset id="test.classes" dir="${build.test.classes.dir}">
   481        <include name="**/framework/*Test.class"/>
   482     </fileset>
   484     <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
   486     <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
   487         <not>
   488             <os family="mac"/>
   489         </not>
   490     </condition>
   492     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   493        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   494       <jvmarg line="${ext.class.path}"/>
   495       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
   496       <propertyset>
   497         <propertyref prefix="testjfx-test-sys-prop."/>
   498         <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
   499       </propertyset>
   500       <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
   501       <classpath>
   502           <pathelement path="${testjfx.run.test.classpath}"/>
   503       </classpath>
   504     </testng>
   505   </target>
   507   <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   508     <fileset id="test.classes" dir="${build.test.classes.dir}">
   509        <include name="**/framework/*Test.class"/>
   510     </fileset>
   512     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   513        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   514       <jvmarg line="${ext.class.path}"/>
   515       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   516       <propertyset>
   517         <propertyref prefix="testmarkdown-test-sys-prop."/>
   518         <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
   519       </propertyset>
   520       <classpath>
   521           <pathelement path="${run.test.classpath}"/>
   522       </classpath>
   523     </testng>
   524   </target>
   526   <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   527     <fileset id="test.classes" dir="${build.test.classes.dir}">
   528        <include name="**/framework/*Test.class"/>
   529     </fileset>
   531     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   532        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   533       <jvmarg line="${ext.class.path}"/>
   534       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   535       <propertyset>
   536         <propertyref prefix="nashorn."/>
   537       </propertyset>
   538       <propertyset>
   539         <propertyref prefix="test262-test-sys-prop."/>
   540         <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
   541       </propertyset>
   542       <classpath>
   543           <pathelement path="${run.test.classpath}"/>
   544       </classpath>
   545     </testng>
   546   </target>
   548   <target name="test262parallel" depends="test262-parallel"/>
   550   <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   551     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   552     <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
   553       <jvmarg line="${ext.class.path}"/>
   554       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   555       <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
   556       <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
   557       <classpath>
   558           <pathelement path="${run.test.classpath}"/>
   559       </classpath>
   560       <syspropertyset>
   561           <propertyref prefix="test262-test-sys-prop."/>
   562           <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
   563       </syspropertyset>
   564     </java>
   565   </target>
   567   <target name="testparallel" depends="test-parallel"/>
   569   <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   570       <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   571       <java classname="${parallel.test.runner}" dir="${basedir}"
   572         failonerror="true"
   573         fork="true">
   574       <jvmarg line="${ext.class.path}"/>
   575       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
   576       <classpath>
   577           <pathelement path="${run.test.classpath}"/>
   578       <pathelement path="${build.test.classes.dir}"/>
   579       </classpath>
   580       <syspropertyset>
   581           <propertyref prefix="test-sys-prop."/>
   582           <mapper type="glob" from="test-sys-prop.*" to="*"/>
   583       </syspropertyset>
   584       </java>
   585   </target>
   587   <target name="all" depends="test, docs"
   588       description="Build, test and generate docs for nashorn"/>
   590   <target name="run" depends="jar"
   591       description="Run the shell with a sample script">
   592     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   593         <jvmarg line="${ext.class.path}"/>
   594         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
   595         <arg value="-dump-on-error"/>
   596         <arg value="test.js"/>
   597     </java>
   598   </target>
   600   <target name="debug" depends="jar"
   601       description="Debug the shell with a sample script">
   602     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   603         <jvmarg line="${ext.class.path}"/>
   604         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
   605         <arg value="--print-code"/>
   606         <arg value="--verify-code"/>
   607         <arg value="--print-symbols"/>
   608         <jvmarg value="-Dnashorn.codegen.debug=true"/>
   609         <arg value="test.js"/>
   610     </java>
   611   </target>
   613   <!-- targets to get external script tests -->
   615   <!-- test262 test suite -->
   616   <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
   617     <!-- clone test262 git repo -->
   618     <exec executable="${git.executable}">
   619        <arg value="clone"/>
   620        <arg value="--branch"/>
   621        <arg value="es5-tests"/>
   622        <arg value="https://github.com/tc39/test262"/>
   623        <arg value="${test.external.dir}/test262"/>
   624     </exec>
   625   </target>
   626   <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
   627     <!-- update test262 git repo -->
   628     <exec executable="${git.executable}" dir="${test.external.dir}/test262">
   629        <arg value="pull"/>
   630     </exec>
   631   </target>
   633   <!-- octane benchmark -->
   634   <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
   635     <!-- checkout octane benchmarks -->
   636     <exec executable="${svn.executable}">
   637        <arg value="--non-interactive"/>
   638        <arg value="--trust-server-cert"/>
   639        <arg value="checkout"/>
   640        <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
   641        <arg value="${test.external.dir}/octane"/>
   642     </exec>
   643   </target>
   644   <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
   645     <!-- update octane benchmarks -->
   646     <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
   647        <arg value="--non-interactive"/>
   648        <arg value="--trust-server-cert"/>
   649        <arg value="update"/>
   650     </exec>
   651   </target>
   653   <!-- sunspider benchmark -->
   654   <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
   655     <!-- checkout sunspider -->
   656     <exec executable="${svn.executable}">
   657        <arg value="--non-interactive"/>
   658        <arg value="--trust-server-cert"/>
   659        <arg value="checkout"/>
   660        <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
   661        <arg value="${test.external.dir}/sunspider"/>
   662     </exec>
   663   </target>
   664   <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
   665     <!-- update sunspider -->
   666     <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
   667        <arg value="--non-interactive"/>
   668        <arg value="--trust-server-cert"/>
   669        <arg value="update"/>
   670     </exec>
   671   </target>
   673   <!-- get all external test scripts -->
   674   <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
   675     <!-- make external test dir -->
   676     <mkdir dir="${test.external.dir}"/>
   678     <!-- jquery -->
   679     <mkdir dir="${test.external.dir}/jquery"/>
   680     <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
   681     <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
   683     <!-- prototype -->
   684     <mkdir dir="${test.external.dir}/prototype"/>
   685     <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"/>
   687     <!-- underscorejs -->
   688     <mkdir dir="${test.external.dir}/underscore"/>
   689     <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
   690     <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
   692     <!-- yui -->
   693     <mkdir dir="${test.external.dir}/yui"/>
   694     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
   695     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
   697     <!-- showdown -->
   698     <mkdir dir="${test.external.dir}/showdown"/>
   699     <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
   700     <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
   702   </target>
   704   <!-- update external test suites that are pulled from source control systems -->
   705   <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
   707   <!-- run all perf tests -->
   708   <target name="perf" depends="externals, update-externals, sunspider, octane"/>
   710   <!-- run all tests -->
   711   <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
   712      <fail message="Exiting.."/>
   713   </target>
   715   <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
   717   <import file="build-benchmark.xml"/>
   719 </project>

mercurial