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