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