make/build.xml

Wed, 20 Aug 2014 10:26:01 +0200

author
attila
date
Wed, 20 Aug 2014 10:26:01 +0200
changeset 963
e2497b11a021
parent 870
ba5b790ed0f5
child 966
620bf937f377
permissions
-rw-r--r--

8027043: Turn global accesses into MethodHandle.constant, with one chance of reassignment, e.g. x = value occuring once in the global scope is ok, twice is not.
8027958: NASHORN TEST: Create tests to test markdown javascript engine work with Nashorn
8028345: Remove nashorn repo "bin" scripts to avoid confusion with JDK bin launcher programs
8029090: Developers should be able to pass nashorn properties and enable/disable JFR from command line
8030169: Need regression test for bug JDK-8010731
8033105: Make sure Nashorn test harness can run zlib benchmark
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
8034206: Make parts of code pipeline reusable in order to facilitate faster warmup and faster lazy compilation.
8035820: Optimistic recompilation
8035836: Array performance improvements
8036127: Prototype filter needs to be applied to getter guard as well, not just getter
8036986: Test should check that correctly type is returned running with optimistic. If optimistic assumption was wrong we should get the right one.
8037086: Check that deoptimizing recompilations are correct
8037177: -Dnashorn.optimistic should be enabled by default, meaning that it has to be explicitly set to false to run with the jdk 8 style conservative types
8037534: Use scope types to determine optimistic types
8037572: Add more test cases to check static types
8037967: Broke the build, by commiting without saving the last review comment
8038223: Symbol trace debug output takes time
8038396: fix for the compiler expression evaluator to be more inquisitive about types
8038398: OptimisticRecompilationTest fails on staging repo nashorn/jdk9/nashorn due to test framework
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
8038413: NPE in unboxInteger
8038416: Access to undefined scoped variables deoptimized too much
8038426: Move all loggers from process wide scope into Global scope
8038799: Guard and unbox boxed primitives types on setting them in Properties to avoid megamorphisism
8038945: Simplify strict undefined checks
8039044: Expand undefined intrinsics for all commutative combinators of scrict undefined checks
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
8040024: BranchOptimizer produces bad code for NaN FP comparison
8040089: Apply to call transform was incomplete. Now passes all tests and performance is back
8040093: Make sure that optimistic splitting works in optimistic types
8040102: Remove all references to Unsafe and definition of anonymous clases from the code
8040655: When processing a RewriteException debug object, the return value has already been reset to null. We need to catch this value before that.
8041434: Add synchronization to the common global constants structure
8041625: AccessorProperty currentType must only by Object.class when non-primitive, and scoping followup problem for lazily generated with bodies
8041905: Fix apply2call bug that prevented avatar.js unit tests from running correctly
8041995: Problems when loading tree expressions with several optimistic program points when optimistically initializing ObjectNodes
8042118: Separate types from symbols
8043002: Improve performance of Nashorn equality operators
8043003: Use strongly referenced generic invokers
8043004: Reduce variability at JavaAdapter call sites
8043132: Nashorn : all tests failed with java.security.AccessControlException
8043133: Fix corner cases of JDK-8041995
8043137: Collapse long sequences of NOP in Nashorn bytecode output
8043232: Index selection of overloaded java new constructors
8043235: Type-based optimizations interfere with continuation methods
8043431: Fix yet another corner case of JDK-8041995
8043504: Octane test harness was missing argument to print_always at one callsite, causing erroneous logging
8043605: Enable history for empty property maps
8043608: Make equality tests inline better
8043611: Move timing dependent benchmark for apply2call specialization to currently_failing. It is dependent that nothing takes machine time when doing the two runs, causing spurious assertions. Suggest running octane.raytrace manually instead to verify that this works, or incorporating it in the nightly test suite
8043632: Parallelize class installation and various script fixes.
8043633: In order to remove global state outside of contexts, make sure Timing class is an instance and not a static global collection of data. Move into Context. Move -Dnashorn.timing to an official logging option.
8043956: Make code caching work with optimistic typing and lazy compilation
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
8044102: Ensure bechmark exclude list for Octane benchmarks is in only one place, project.properties, and fix benchmark harness
8044154: Nashorn : all tests failed with java.security.AccessControlException
8044171: Make optimistic exception handlers smaller
8044502: Get rid of global optimistic flag
8044518: Ensure exceptions related to optimistic recompilation are not serializable
8044533: Deoptimizing negation produces wrong result for zero
8044534: Constant folding for unary + should produce int for boolean literals
8044760: Avoid PropertyMap duplicate for global instances
8044786: Some tests fail with non-optimistic compilation
8044803: Unnecessary restOf check
8044816: On-demand compiled top-level program doesn't need :createProgramFunction
8044851: nashorn properties leak memory
8046013: TypeError: Cannot apply "with" to non script object
8046014: MultiGlobalCompiledScript should cache :createProgramFunction handle
8046025: AccessorProperty.getGetter is not threadsafe
8046026: CompiledFunction.relinkComposableInvoker assert is being hit
8046201: Avoid repeated flattening of nested ConsStrings
8046215: Running uncompilable scripts throws NullPointerException
8046898: Make sure that lazy compilation is the default, remove redundant "enable lazy compilation" flags, added warning message if compile logging is enabled and lazy is switched off. Verified existing test suite code coverage equivalence between lazy and eager.
8046905: apply on apply is broken
8046921: Deoptimization type information peristence
8047035: (function() "hello")() crashes in Lexer with jdk9
8047057: Add a regression test for the passing test cases from JDK-8042304
8047067: all eval arguments need to be copied in Lower
8047078: Fuzzing bug discovered when ArrayLiteralNodes weren't immutable
8047166: 'do with({}) break ; while(0);' crashes in CodeGenerator
8047331: Assertion in CompiledFunction when running earley-boyer after Merge
8047357: More precise synthetic return + unreachable throw
8047359: large string size RangeError should be thrown rather than reporting negative length
8047369: Add regression tests for passing test cases of JDK-8024971
8047371: local variable declaration in TypeEvaluator should use ScriptObject.addOwnProperty instead of .set
8047728: (function(x){var o={x:0}; with(o){delete x} return o.x})() evaluates to 0 instead of undefined
8047959: bindings created for declarations in eval code are not mutable
8048009: Type info caching accidentally defeated
8048071: eval within 'with' statement does not use correct scope if with scope expression has a copy of eval
8048079: Persistent code store is broken after optimistic types merge
8048505: ScriptingFunctions.readFully couldn't handle file names represented as ConsStrings
8048586: String concatenation with optimistic types is slow
8048718: JSON.parse('{"0":0, "64":0}') throws ArrayindexOutOfBoundsException
8048869: Reduce compile time by about 5% by removing the Class.casts from the AST nodes
8049086: Minor API convenience functions on "Java" object
8049222: JSType class exposes public mutable arrays
8049223: RewriteException class exposes public mutable arrays
8049242: Explicit constructor overload selection should work with StaticClass as well
8049318: Test hideLocationProperties.js fails on Window due to backslash in path
8049524: Global object initialization via javax.script API should be minimal
8050432: javax.script.filename variable should not be enumerable with nashorn engine's ENGINE_SCOPE bindings
8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
8051019: Separate src and test execution sandbox directories
8051346: Test262 tests for ECMAScript 5 now in branch "es5-tests"
8051439: Wrong type calculated for ADD operator with undefined operand
8051839: GuardedInvocation needs to clone an argument
8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
8053910: ScriptObjectMirror causing havoc with Invocation interface
8053913: Auto format caused warning in CompositeTypeBasedGuardingDynamicLinker
8054223: Nashorn: AssertionError when use __DIR__ and ScriptEngine.eval()
8054411: Add nashorn.args.prepend system property
8054503: test/script/external/test262/test/suite/ch12/12.6/12.6.4/12.6.4-2.js fails with tip
8054651: Global.initConstructor and ScriptFunction.getPrototype(Object) can have stricter types
8054898: Avoid creation of empty type info files
8054993: type info cache may be disabled for test262 and tests explicitly changing that property should use @fork
8055034: jjs exits interactive mode if exception was thrown when trying to print value of last evaluated expression
8055042: Compile-time expression evaluator was missing variables
8055107: Extension directives to turn on callsite profiling, tracing, AST print and other debug features locally
8055139: test/script/trusted/JDK-8055107.js fails with access control exception
8055186: Backport Nashorn optimistic typing to 8u repository
8055529: Clean up the bin directory
Reviewed-by: jlaskey, lagergren, sundar
Contributed-by: marcus.largergren@oracle.com, hannes.wallnoefer@oracle.com, sundararajan.athijegannathan@oracle.com

     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="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>
    63     <!-- enable/disable make code coverage -->
    64     <condition property="cc.enabled">
    65         <istrue value="${make.code.coverage}" />
    66     </condition>
    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>
    73     <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
    74       <istrue value="${jfr}"/>
    75     </condition>
    76   </target>
    78   <target name="init" depends="init-conditions, init-cc">
    79     <!-- extends jvm args -->
    80     <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
    81     <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
    83     <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
    84     <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
    85     <echo message="run.test.xms=${run.test.xms}"/>
    86     <echo message="run.test.xmx=${run.test.xmx}"/>
    88   </target>
    90   <target name="prepare" depends="init">
    91     <mkdir dir="${build.dir}"/>
    92     <mkdir dir="${build.classes.dir}"/>
    93     <mkdir dir="${build.classes.dir}/META-INF/services"/>
    94     <mkdir dir="${build.test.classes.dir}"/>
    95     <mkdir dir="${dist.dir}"/>
    96     <mkdir dir="${dist.javadoc.dir}"/>
    97   </target>
    99   <target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
   100     <delete includeemptydirs="true">
   101       <fileset dir="${build.dir}" erroronmissingdir="false"/>
   102     </delete>
   103     <delete dir="${dist.dir}"/>
   104   </target>
   106   <!-- do it only if ASM is not available -->
   107   <target name="compile-asm" depends="prepare" unless="asm.available">
   108     <javac srcdir="${jdk.asm.src.dir}"
   109            destdir="${build.classes.dir}"
   110            excludes="**/optimizer/* **/xml/* **/attrs/*"
   111            source="${javac.source}"
   112            target="${javac.target}"
   113            debug="${javac.debug}"
   114            encoding="${javac.encoding}"
   115            includeantruntime="false"/>
   116   </target>
   118   <target name="compile" depends="compile-asm" description="Compiles nashorn">
   119     <javac srcdir="${src.dir}"
   120            destdir="${build.classes.dir}"
   121            classpath="${javac.classpath}"
   122            source="${javac.source}"
   123            target="${javac.target}"
   124            debug="${javac.debug}"
   125            encoding="${javac.encoding}"
   126            includeantruntime="false" fork="true">
   127       <compilerarg value="-J-Djava.ext.dirs="/>
   128       <compilerarg value="-Xlint:all"/>
   129       <compilerarg value="-XDignore.symbol.file"/>
   130       <compilerarg value="-Xdiags:verbose"/>
   131     </javac>
   132     <copy todir="${build.classes.dir}/META-INF/services">
   133        <fileset dir="${meta.inf.dir}/services/"/>
   134     </copy>
   135      <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
   136        <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
   137     </copy>
   138     <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
   139        <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
   140     </copy>
   141     <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
   142        <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
   143     </copy>
   144     <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
   146     <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
   147     <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
   148     <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
   149   </target>
   151   <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
   152     <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
   153       <fileset dir="${build.classes.dir}"/>
   154       <manifest>
   155         <attribute name="Archiver-Version" value="n/a"/>
   156         <attribute name="Build-Jdk" value="${java.runtime.version}"/>
   157         <attribute name="Built-By" value="n/a"/>
   158         <attribute name="Created-By" value="Ant jar task"/>
   159         <section name="jdk/nashorn/">
   160           <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
   161           <attribute name="Implementation-Version" value="${nashorn.version}"/>
   162         </section>
   163       </manifest>
   164     </jar>
   165   </target>
   167   <target name="use-promoted-nashorn" depends="init">
   168     <delete file="${dist.dir}/nashorn.jar"/>
   169     <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
   170     <property name="compile.suppress.jar" value="defined"/>
   171   </target>
   173   <target name="build-fxshell" depends="jar">
   174     <description>Builds the javafx shell.</description>
   175     <mkdir dir="${fxshell.classes.dir}"/>
   176     <javac srcdir="${fxshell.dir}"
   177            destdir="${fxshell.classes.dir}"
   178            classpath="${dist.jar}:${javac.classpath}"
   179            debug="${javac.debug}"
   180            encoding="${javac.encoding}"
   181            includeantruntime="false">
   182     </javac>
   183     <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
   184       <fileset dir="${fxshell.classes.dir}"/>
   185       <manifest>
   186         <attribute name="Archiver-Version" value="n/a"/>
   187         <attribute name="Build-Jdk" value="${java.runtime.version}"/>
   188         <attribute name="Built-By" value="n/a"/>
   189         <attribute name="Created-By" value="Ant jar task"/>
   190         <section name="jdk/nashorn/">
   191           <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/>
   192           <attribute name="Implementation-Version" value="${nashorn.version}"/>
   193         </section>
   194       </manifest>
   195     </jar>
   196   </target>
   198   <target name="javadoc" depends="jar">
   199     <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" 
   200         extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
   201         additionalparam="-quiet" failonerror="true">
   202       <classpath>
   203         <pathelement location="${build.classes.dir}"/>
   204       </classpath>
   205       <fileset dir="${src.dir}" includes="**/*.java"/>
   206       <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
   207       <link href="http://docs.oracle.com/javase/8/docs/api/"/>
   208       <!-- The following tags are used only in ASM sources - just ignore these -->
   209       <tag name="label" description="label tag in ASM sources" enabled="false"/>
   210       <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
   211       <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
   212     </javadoc>
   213   </target>
   215   <!-- generate javadoc only for nashorn extension api classes -->
   216   <target name="javadocapi" depends="jar">
   217     <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}" 
   218         windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true">
   219       <classpath>
   220         <pathelement location="${build.classes.dir}"/>
   221       </classpath>
   222       <fileset dir="${src.dir}" includes="jdk/nashorn/api/**/*.java"/>
   223       <link href="http://docs.oracle.com/javase/8/docs/api/"/>
   224     </javadoc>
   225   </target>
   228   <!-- generate shell.html for shell tool documentation -->
   229   <target name="shelldoc" depends="jar">
   230     <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
   231       <jvmarg line="${ext.class.path}"/>
   232       <arg value="-scripting"/>
   233       <arg value="docs/genshelldoc.js"/>
   234     </java>
   235   </target>
   237   <!-- generate all docs -->
   238   <target name="docs" depends="javadoc, shelldoc"/>
   240   <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
   241   <target name="dist" depends="jar">
   242       <zip destfile="${build.zip}" basedir=".."
   243           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
   244       <tar destfile="${build.gzip}" basedir=".." compression="gzip"
   245           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
   246   </target>
   248   <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
   249     <!-- testng task -->
   250     <taskdef name="testng" classname="org.testng.TestNGAntTask"
   251         classpath="${file.reference.testng.jar}"/>
   253     <javac srcdir="${test.src.dir}"
   254            destdir="${build.test.classes.dir}"
   255            classpath="${javac.test.classpath}"
   256            source="${javac.source}"
   257            target="${javac.target}"
   258            debug="${javac.debug}"
   259            encoding="${javac.encoding}"
   260            includeantruntime="false" fork="true">
   261         <compilerarg value="-J-Djava.ext.dirs="/>
   262         <compilerarg value="-Xlint:unchecked"/>
   263         <compilerarg value="-Xlint:deprecation"/>
   264         <compilerarg value="-Xdiags:verbose"/>
   265     </javac>
   267     <copy todir="${build.test.classes.dir}/META-INF/services">
   268        <fileset dir="${test.src.dir}/META-INF/services/"/>
   269     </copy>
   271     <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources">
   272        <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/>
   273     </copy>
   275     <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources">
   276        <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/>
   277     </copy>
   279     <!-- tests that check nashorn internals and internal API -->
   280     <jar jarfile="${nashorn.internal.tests.jar}">
   281       <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
   282     </jar>
   284     <!-- tests that check nashorn script engine (jsr-223) API -->
   285     <jar jarfile="${nashorn.api.tests.jar}">
   286       <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
   287       <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
   288       <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
   289     </jar>
   291   </target>
   293   <target name="generate-policy-file" depends="prepare">
   294     <echo file="${build.dir}/nashorn.policy">
   296 grant codeBase "file:/${toString:nashorn.ext.path}/nashorn.jar" {
   297     permission java.security.AllPermission;
   298 };
   300 grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
   301     permission java.security.AllPermission;
   302 };
   304 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
   305     permission java.security.AllPermission;
   306 };
   307 //// in case of absolute path:
   308 grant codeBase "file:/${nashorn.internal.tests.jar}" {
   309     permission java.security.AllPermission;
   310 };
   312 grant codeBase "file:/${file.reference.testng.jar}" {
   313     permission java.security.AllPermission;
   314 };
   316 grant codeBase "file:/${basedir}/test/script/trusted/*" {
   317     permission java.security.AllPermission;
   318 };
   320 grant codeBase "file:/${basedir}/test/script/maptests/*" {
   321     permission java.io.FilePermission "${basedir}/test/script/maptests/*","read";
   322     permission java.lang.RuntimePermission "nashorn.debugMode";
   323 };
   325 grant codeBase "file:/${basedir}/test/script/basic/*" {
   326     permission java.io.FilePermission "${basedir}/test/script/-", "read";
   327     permission java.io.FilePermission "$${user.dir}", "read";
   328     permission java.util.PropertyPermission "user.dir", "read";
   329     permission java.util.PropertyPermission "nashorn.test.*", "read";
   330 };
   332 grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
   333     permission java.io.FilePermission "${basedir}/test/script/-", "read";
   334     permission java.io.FilePermission "$${user.dir}", "read";
   335     permission java.util.PropertyPermission "user.dir", "read";
   336     permission java.util.PropertyPermission "nashorn.test.*", "read";
   337 };
   339 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
   340     permission java.util.PropertyPermission "java.security.policy", "read";
   341 };
   343 grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
   344     permission java.lang.RuntimePermission "nashorn.JavaReflection";
   345 };
   347 grant codeBase "file:/${basedir}/test/script/markdown.js" {
   348     permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
   349 };
   351     </echo>
   353     <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
   354     <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace>   <!--hack for Unix - to avoid leading // in URLs -->
   356   </target>
   358   <target name="check-external-tests">
   359       <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
   360       <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
   361       <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
   362       <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
   363       <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
   364       <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
   365       <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
   366       <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
   367   </target>
   369   <target name="check-testng" unless="testng.available">
   370     <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
   371   </target>
   373   <!-- only to be invoked as dependency of "test" target -->
   374   <target name="-test-classes-all" depends="jar" unless="test.class">
   375       <fileset id="test.classes" dir="${build.test.classes.dir}">
   376           <include name="**/api/javaaccess/*Test.class"/>
   377           <include name="**/api/scripting/*Test.class"/>
   378           <include name="**/codegen/*Test.class"/>
   379           <include name="**/parser/*Test.class"/>
   380           <include name="**/runtime/*Test.class"/>
   381           <include name="**/runtime/regexp/*Test.class"/>
   382           <include name="**/runtime/regexp/joni/*Test.class"/>
   383           <include name="**/framework/*Test.class"/>
   384      </fileset>
   385   </target>
   387   <!-- only to be invoked as dependency of "test" target -->
   388   <target name="-test-classes-single" depends="jar" if="test.class">
   389      <fileset id="test.classes" dir="${build.test.classes.dir}">
   390          <include name="${test.class}*"/>
   391      </fileset>
   392   </target>
   394   <!-- only to be invoked as dependency of "test" target -->
   395   <target name="-test-nosecurity" unless="test.class">
   396     <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
   397       <include name="**/framework/ScriptTest.class"/>
   398     </fileset>
   399     <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes"
   400        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   401       <jvmarg line="${ext.class.path}"/>
   402       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
   403       <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
   404       <propertyset>
   405         <propertyref prefix="nashorn."/>
   406       </propertyset>
   407       <propertyset>
   408         <propertyref prefix="test-sys-prop-no-security."/>
   409         <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
   410       </propertyset>
   411       <classpath>
   412           <pathelement path="${run.test.classpath}"/>
   413       </classpath>
   414     </testng>
   415   </target>
   417   <!-- only to be invoked as dependency of "test" target -->
   418   <target name="-test-security">
   419     <delete dir="${build.dir}/nashorn_code_cache"/>
   420     <property name="debug.test.jvmargs" value=""/>
   421     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   422        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   423       <jvmarg line="${ext.class.path}"/>
   424       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   425       <jvmarg line="${debug.test.jvmargs}"/>
   426       <propertyset>
   427         <propertyref prefix="nashorn."/>
   428       </propertyset>
   429       <propertyset>
   430         <propertyref prefix="test-sys-prop."/>
   431         <mapper from="test-sys-prop.*" to="*" type="glob"/>
   432       </propertyset>
   433       <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
   434       <classpath>
   435           <pathelement path="${run.test.classpath}"/>
   436       </classpath>
   437     </testng>
   438   </target>
   440   <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"/>
   442   <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
   443     <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."/>
   444   </target>
   446   <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
   447     <fileset id="test.classes" dir="${build.test.classes.dir}">
   448        <include name="**/framework/*Test.class"/>
   449     </fileset>
   451     <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
   453     <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
   454         <not>
   455             <os family="mac"/>
   456         </not>
   457     </condition>
   459     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   460        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   461       <jvmarg line="${ext.class.path}"/>
   462       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
   463       <propertyset>
   464         <propertyref prefix="testjfx-test-sys-prop."/>
   465         <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
   466       </propertyset>
   467       <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
   468       <classpath>
   469           <pathelement path="${testjfx.run.test.classpath}"/>
   470       </classpath>
   471     </testng>
   472   </target>
   474   <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   475     <fileset id="test.classes" dir="${build.test.classes.dir}">
   476        <include name="**/framework/*Test.class"/>
   477     </fileset>
   479     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   480        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   481       <jvmarg line="${ext.class.path}"/>
   482       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   483       <propertyset>
   484         <propertyref prefix="testmarkdown-test-sys-prop."/>
   485         <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
   486       </propertyset>
   487       <classpath>
   488           <pathelement path="${run.test.classpath}"/>
   489       </classpath>
   490     </testng>
   491   </target>
   493   <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   494     <fileset id="test.classes" dir="${build.test.classes.dir}">
   495        <include name="**/framework/*Test.class"/>
   496     </fileset>
   498     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   499        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   500       <jvmarg line="${ext.class.path}"/>
   501       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   502       <propertyset>
   503         <propertyref prefix="nashorn."/>
   504       </propertyset>
   505       <propertyset>
   506         <propertyref prefix="test262-test-sys-prop."/>
   507         <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
   508       </propertyset>
   509       <classpath>
   510           <pathelement path="${run.test.classpath}"/>
   511       </classpath>
   512     </testng>
   513   </target>
   515   <target name="test262parallel" depends="test262-parallel"/>
   517   <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   518     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   519     <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
   520       <jvmarg line="${ext.class.path}"/>
   521       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
   522       <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
   523       <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
   524       <classpath>
   525           <pathelement path="${run.test.classpath}"/>
   526       </classpath>
   527       <syspropertyset>
   528           <propertyref prefix="test262-test-sys-prop."/>
   529           <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
   530       </syspropertyset>
   531     </java>
   532   </target>
   534   <target name="testparallel" depends="test-parallel"/>
   536   <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   537       <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   538       <java classname="${parallel.test.runner}" dir="${basedir}"
   539         failonerror="true"
   540         fork="true">
   541       <jvmarg line="${ext.class.path}"/>
   542       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
   543       <classpath>
   544           <pathelement path="${run.test.classpath}"/>
   545       <pathelement path="${build.test.classes.dir}"/>
   546       </classpath>
   547       <syspropertyset>
   548           <propertyref prefix="test-sys-prop."/>
   549           <mapper type="glob" from="test-sys-prop.*" to="*"/>
   550       </syspropertyset>
   551       </java>
   552   </target>
   554   <target name="all" depends="test, docs"
   555       description="Build, test and generate docs for nashorn"/>
   557   <target name="run" depends="jar"
   558       description="Run the shell with a sample script">
   559     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   560         <jvmarg line="${ext.class.path}"/>
   561         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
   562         <arg value="-dump-on-error"/>
   563         <arg value="test.js"/>
   564     </java>
   565   </target>
   567   <target name="debug" depends="jar"
   568       description="Debug the shell with a sample script">
   569     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   570         <jvmarg line="${ext.class.path}"/>
   571         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
   572         <arg value="--print-code"/>
   573         <arg value="--verify-code"/>
   574         <arg value="--print-symbols"/>
   575         <jvmarg value="-Dnashorn.codegen.debug=true"/>
   576         <arg value="test.js"/>
   577     </java>
   578   </target>
   580   <!-- targets to get external script tests -->
   582   <!-- test262 test suite -->
   583   <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
   584     <!-- clone test262 git repo -->
   585     <exec executable="${git.executable}">
   586        <arg value="clone"/>
   587        <arg value="--branch"/>
   588        <arg value="es5-tests"/>
   589        <arg value="https://github.com/tc39/test262"/>
   590        <arg value="${test.external.dir}/test262"/>
   591     </exec>
   592   </target>
   593   <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
   594     <!-- update test262 git repo -->
   595     <exec executable="${git.executable}" dir="${test.external.dir}/test262">
   596        <arg value="pull"/>
   597     </exec>
   598   </target>
   600   <!-- octane benchmark -->
   601   <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
   602     <!-- checkout octane benchmarks -->
   603     <exec executable="${svn.executable}">
   604        <arg value="--non-interactive"/>
   605        <arg value="--trust-server-cert"/>
   606        <arg value="checkout"/>
   607        <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
   608        <arg value="${test.external.dir}/octane"/>
   609     </exec>
   610   </target>
   611   <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
   612     <!-- update octane benchmarks -->
   613     <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
   614        <arg value="--non-interactive"/>
   615        <arg value="--trust-server-cert"/>
   616        <arg value="update"/>
   617     </exec>
   618   </target>
   620   <!-- sunspider benchmark -->
   621   <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
   622     <!-- checkout sunspider -->
   623     <exec executable="${svn.executable}">
   624        <arg value="--non-interactive"/>
   625        <arg value="--trust-server-cert"/>
   626        <arg value="checkout"/>
   627        <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
   628        <arg value="${test.external.dir}/sunspider"/>
   629     </exec>
   630   </target>
   631   <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
   632     <!-- update sunspider -->
   633     <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
   634        <arg value="--non-interactive"/>
   635        <arg value="--trust-server-cert"/>
   636        <arg value="update"/>
   637     </exec>
   638   </target>
   640   <!-- get all external test scripts -->
   641   <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
   642     <!-- make external test dir -->
   643     <mkdir dir="${test.external.dir}"/>
   645     <!-- jquery -->
   646     <mkdir dir="${test.external.dir}/jquery"/>
   647     <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
   648     <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
   650     <!-- prototype -->
   651     <mkdir dir="${test.external.dir}/prototype"/>
   652     <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"/>
   654     <!-- underscorejs -->
   655     <mkdir dir="${test.external.dir}/underscore"/>
   656     <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
   657     <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
   659     <!-- yui -->
   660     <mkdir dir="${test.external.dir}/yui"/>
   661     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
   662     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
   664     <!-- showdown -->
   665     <mkdir dir="${test.external.dir}/showdown"/>
   666     <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
   667     <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
   669   </target>
   671   <!-- update external test suites that are pulled from source control systems -->
   672   <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
   674   <!-- run all perf tests -->
   675   <target name="perf" depends="externals, update-externals, sunspider, octane"/>
   677   <!-- run all tests -->
   678   <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
   679      <fail message="Exiting.."/>
   680   </target>
   682   <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
   684   <import file="build-benchmark.xml"/>
   686 </project>

mercurial