diff options
Diffstat (limited to 'make/build.xml')
-rw-r--r-- | make/build.xml | 207 |
1 files changed, 159 insertions, 48 deletions
diff --git a/make/build.xml b/make/build.xml index 3b30a089..a7539f48 100644 --- a/make/build.xml +++ b/make/build.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> + <!-- Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -21,19 +22,22 @@ or visit www.oracle.com if you need additional information or have any questions. --> + <project name="nashorn" default="test" basedir=".."> <import file="build-nasgen.xml"/> - <import file="build-benchmark.xml"/> <import file="code_coverage.xml"/> - <target name="init-conditions"> <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later --> <property file="${user.home}/.nashorn.project.local.properties"/> <loadproperties srcFile="make/project.properties"/> + <path id="dist.path"> + <pathelement location="${dist.dir}"/> + </path> <path id="nashorn.ext.path"> <pathelement location="${dist.dir}"/> + <pathelement location="${java.ext.dirs}"/> </path> <property name="ext.class.path" value="-Djava.ext.dirs="${toString:nashorn.ext.path}""/> <condition property="svn.executable" value="/usr/local/bin/svn" else="svn"> @@ -45,13 +49,11 @@ <condition property="git.executable" value="/usr/local/bin/git" else="git"> <available file="/usr/local/bin/git"/> </condition> - <!-- check if JDK already has ASM classes --> - <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/> <!-- check if testng.jar is avaiable --> <available property="testng.available" file="${file.reference.testng.jar}"/> <!-- check if Jemmy ang testng.jar are avaiable --> <condition property="jemmy.jfx.testng.available" value="true"> - <and> + <and> <available file="${file.reference.jemmyfx.jar}"/> <available file="${file.reference.jemmycore.jar}"/> <available file="${file.reference.jemmyawtinput.jar}"/> @@ -69,13 +71,39 @@ <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt"> <istrue value="${make.code.coverage}" /> </condition> + + <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else=""> + <istrue value="${jfr}"/> + </condition> + </target> + + <!-- check minimum ant version required to be 1.8.4 --> + <target name="check-ant-version"> + <property name="ant.version.required" value="1.8.4"/> + <antversion property="ant.current.version" /> + <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.8.4 or above."> + <condition> + <not> + <antversion atleast="${ant.version.required}"/> + </not> + </condition> + </fail> </target> - <target name="init" depends="init-conditions, init-cc"> + <target name="check-java-version"> + <!-- look for a Class that is available only in jdk1.8 or above --> + <!-- core/exposed API class is better than an implementation class --> + <available property="jdk1.8+" classname="java.util.stream.Stream"/> + <!-- need jdk1.8 or above --> + <fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+"> + </fail> + </target> + + <target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc"> <!-- extends jvm args --> - <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs}"/> - <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs}" /> + <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/> + <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/> <echo message="run.test.jvmargs=${run.test.jvmargs}"/> <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/> @@ -100,19 +128,7 @@ <delete dir="${dist.dir}"/> </target> - <!-- do it only if ASM is not available --> - <target name="compile-asm" depends="prepare" unless="asm.available"> - <javac srcdir="${jdk.asm.src.dir}" - destdir="${build.classes.dir}" - excludes="**/optimizer/* **/xml/* **/attrs/*" - source="${javac.source}" - target="${javac.target}" - debug="${javac.debug}" - encoding="${javac.encoding}" - includeantruntime="false"/> - </target> - - <target name="compile" depends="compile-asm" description="Compiles nashorn"> + <target name="compile" depends="prepare" description="Compiles nashorn"> <javac srcdir="${src.dir}" destdir="${build.classes.dir}" classpath="${javac.classpath}" @@ -122,8 +138,7 @@ encoding="${javac.encoding}" includeantruntime="false" fork="true"> <compilerarg value="-J-Djava.ext.dirs="/> - <compilerarg value="-Xlint:unchecked"/> - <compilerarg value="-Xlint:deprecation"/> + <compilerarg value="-Xlint:all"/> <compilerarg value="-XDignore.symbol.file"/> <compilerarg value="-Xdiags:verbose"/> </javac> @@ -140,6 +155,7 @@ <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/> </copy> <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/> + <copy file="${src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${build.classes.dir}/jdk/nashorn/internal/codegen"/> <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/> <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo> @@ -291,6 +307,10 @@ <target name="generate-policy-file" depends="prepare"> <echo file="${build.dir}/nashorn.policy"> +grant codeBase "file:/${toString:dist.path}/nashorn.jar" { + permission java.security.AllPermission; +}; + grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" { permission java.security.AllPermission; }; @@ -298,6 +318,14 @@ grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" { grant codeBase "file:/${basedir}/${file.reference.testng.jar}" { permission java.security.AllPermission; }; +//// in case of absolute path: +grant codeBase "file:/${nashorn.internal.tests.jar}" { + permission java.security.AllPermission; +}; + +grant codeBase "file:/${file.reference.testng.jar}" { + permission java.security.AllPermission; +}; grant codeBase "file:/${basedir}/test/script/trusted/*" { permission java.security.AllPermission; @@ -322,6 +350,13 @@ grant codeBase "file:/${basedir}/test/script/basic/parser/*" { permission java.util.PropertyPermission "nashorn.test.*", "read"; }; +grant codeBase "file:/${basedir}/test/script/basic/es6/*" { + permission java.io.FilePermission "${basedir}/test/script/-", "read"; + permission java.io.FilePermission "$${user.dir}", "read"; + permission java.util.PropertyPermission "user.dir", "read"; + permission java.util.PropertyPermission "nashorn.test.*", "read"; +}; + grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { permission java.util.PropertyPermission "java.security.policy", "read"; }; @@ -330,6 +365,10 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { permission java.lang.RuntimePermission "nashorn.JavaReflection"; }; +grant codeBase "file:/${basedir}/test/script/markdown.js" { + permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read"; +}; + </echo> <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators --> @@ -345,6 +384,7 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/> <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/> <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/> + <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/> </target> <target name="check-testng" unless="testng.available"> @@ -377,10 +417,11 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}"> <include name="**/framework/ScriptTest.class"/> </fileset> - <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes" + <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes" verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/> + <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/> <propertyset> <propertyref prefix="nashorn."/> </propertyset> @@ -388,6 +429,7 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <propertyref prefix="test-sys-prop-no-security."/> <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/> </propertyset> + <sysproperty key="optimistic.override" value="${optimistic}"/> <classpath> <pathelement path="${run.test.classpath}"/> </classpath> @@ -398,15 +440,19 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <target name="-test-security"> <delete dir="${build.dir}/nashorn_code_cache"/> <property name="debug.test.jvmargs" value=""/> - <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" - verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> + <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes" + verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> <jvmarg line="${debug.test.jvmargs}"/> <propertyset> + <propertyref prefix="nashorn."/> + </propertyset> + <propertyset> <propertyref prefix="test-sys-prop."/> <mapper from="test-sys-prop.*" to="*" type="glob"/> </propertyset> + <sysproperty key="optimistic.override" value="${optimistic}"/> <sysproperty key="test.js.excludes.file" value="${exclude.list}"/> <classpath> <pathelement path="${run.test.classpath}"/> @@ -414,18 +460,30 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { </testng> </target> - <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"/> + <target name="test" depends="test-pessimistic, test-optimistic"/> - <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file"> - <!-- use just build.test.classes.dir to avoid referring to TestNG --> - <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" failonerror="true" fork="true"> - <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper type="glob" from="test-sys-prop.*" to="*"/> - </syspropertyset> - </java> + <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"> + <echo message="Running test suite in OPTIMISTIC mode..."/> + <antcall target="-test-nosecurity" inheritRefs="true"> + <param name="optimistic" value="true"/> + <param name="testResultsSubDir" value="optimistic"/> + </antcall> + <antcall target="-test-security" inheritRefs="true"> + <param name="optimistic" value="true"/> + <param name="testResultsSubDir" value="optimistic"/> + </antcall> + </target> + + <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"> + <echo message="Running test suite in PESSIMISTIC mode..."/> + <antcall target="-test-nosecurity" inheritRefs="true"> + <param name="optimistic" value="false"/> + <param name="testResultsSubDir" value="pessimistic"/> + </antcall> + <antcall target="-test-security" inheritRefs="true"> + <param name="optimistic" value="false"/> + <param name="testResultsSubDir" value="pessimistic"/> + </antcall> </target> <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available"> @@ -436,19 +494,19 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <fileset id="test.classes" dir="${build.test.classes.dir}"> <include name="**/framework/*Test.class"/> </fileset> - + <copy file="${file.reference.jfxrt.jar}" todir="dist"/> - + <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" "> - <not> + <not> <os family="mac"/> </not> - </condition> - + </condition> + <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/> <propertyset> <propertyref prefix="testjfx-test-sys-prop."/> <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/> @@ -459,7 +517,26 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { </classpath> </testng> </target> - + + <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> + <fileset id="test.classes" dir="${build.test.classes.dir}"> + <include name="**/framework/*Test.class"/> + </fileset> + + <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" + verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> + <jvmarg line="${ext.class.path}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> + <propertyset> + <propertyref prefix="testmarkdown-test-sys-prop."/> + <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/> + </propertyset> + <classpath> + <pathelement path="${run.test.classpath}"/> + </classpath> + </testng> + </target> + <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> <fileset id="test.classes" dir="${build.test.classes.dir}"> <include name="**/framework/*Test.class"/> @@ -468,7 +545,10 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> + <propertyset> + <propertyref prefix="nashorn."/> + </propertyset> <propertyset> <propertyref prefix="test262-test-sys-prop."/> <mapper from="test262-test-sys-prop.*" to="*" type="glob"/> @@ -485,7 +565,9 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <!-- use just build.test.classes.dir to avoid referring to TestNG --> <java classname="${parallel.test.runner}" dir="${basedir}" fork="true"> <jvmarg line="${ext.class.path}"/> - <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> + <!-- avoid too many typeinfo cache files. Each script is run only once anyway --> + <jvmarg line="-Dnashorn.typeInfo.disabled=true"/> <classpath> <pathelement path="${run.test.classpath}"/> </classpath> @@ -496,6 +578,26 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { </java> </target> + <target name="testparallel" depends="test-parallel"/> + + <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> + <!-- use just build.test.classes.dir to avoid referring to TestNG --> + <java classname="${parallel.test.runner}" dir="${basedir}" + failonerror="true" + fork="true"> + <jvmarg line="${ext.class.path}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <classpath> + <pathelement path="${run.test.classpath}"/> + <pathelement path="${build.test.classes.dir}"/> + </classpath> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper type="glob" from="test-sys-prop.*" to="*"/> + </syspropertyset> + </java> + </target> + <target name="all" depends="test, docs" description="Build, test and generate docs for nashorn"/> @@ -529,6 +631,8 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <!-- clone test262 git repo --> <exec executable="${git.executable}"> <arg value="clone"/> + <arg value="--branch"/> + <arg value="es5-tests"/> <arg value="https://github.com/tc39/test262"/> <arg value="${test.external.dir}/test262"/> </exec> @@ -604,6 +708,11 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> + <!-- showdown --> + <mkdir dir="${test.external.dir}/showdown"/> + <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> + <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> + </target> <!-- update external test suites that are pulled from source control systems --> @@ -619,4 +728,6 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/> + <import file="build-benchmark.xml"/> + </project> |