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