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