8080275: transparently download testng.jar for Nashorn testing

Instead of asking the user to manually download and install testng.jar, automate the process via "ant externals".

Reviewed-by: hannesw, sundar
This commit is contained in:
Michael Haupt 2015-06-02 14:35:03 +02:00
parent 6d8372c2a7
commit db8a93364f
3 changed files with 27 additions and 15 deletions

View File

@ -72,14 +72,11 @@ after which you can view the generated documentation at dist/javadoc/index.html.
- Running tests
Nashorn tests are TestNG based. Running tests requires downloading the
TestNG library and placing its jar file into the lib subdirectory:
TestNG library and placing its jar file into the test/lib subdirectory. This is
done automatically when executing the "ant externals" command to get external
test suites (see below).
# download and install TestNG
wget http://testng.org/testng-x.y.z.zip
unzip testng-x.y.z.zip
cp testng-x.y.z/testng-x.y.z.jar test/lib/testng.jar
After that, you can run the tests using:
Once TestNG is properly installed, you can run the tests using:
cd make
ant clean test

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -396,7 +396,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
</target>
<target name="check-testng" unless="testng.available">
<echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
<echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/>
</target>
<!-- only to be invoked as dependency of "test" target -->
@ -694,7 +694,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
</target>
<!-- get all external test scripts -->
<target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
<target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider, get-testng">
<!-- make external test dir -->
<mkdir dir="${test.external.dir}"/>
@ -735,6 +735,18 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
<fail message="Exiting.."/>
</target>
<!-- download and install testng.jar -->
<target name="get-testng" unless="testng.available">
<get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
<unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}">
<patternset>
<include name="testng-6.8/testng-6.8.jar"/>
</patternset>
</unzip>
<move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/>
<delete dir="${test.lib}${file.separator}testng-6.8"/>
</target>
<target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
<import file="build-benchmark.xml"/>

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -77,8 +77,11 @@ fxshell.jar = ${dist.dir}/nashornfx.jar
# configuration for java flight recorder
run.test.jvmargs.jfr=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128
# test library location
test.lib=${basedir}${file.separator}test${file.separator}lib
# jars refererred
file.reference.testng.jar=test/lib/testng.jar
file.reference.testng.jar=${test.lib}${file.separator}testng.jar
# Set testng verbose level
# From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed)
@ -243,9 +246,9 @@ testjfx-test-sys-prop.test.js.framework=\
-fx \
${test.script.dir}${file.separator}jfx.js
file.reference.jemmyfx.jar=test${file.separator}lib${file.separator}JemmyFX.jar
file.reference.jemmycore.jar=test${file.separator}lib${file.separator}JemmyCore.jar
file.reference.jemmyawtinput.jar=test${file.separator}lib${file.separator}JemmyAWTInput.jar
file.reference.jemmyfx.jar=${test.lib}${file.separator}JemmyFX.jar
file.reference.jemmycore.jar=${test.lib}${file.separator}JemmyCore.jar
file.reference.jemmyawtinput.jar=${test.lib}${file.separator}JemmyAWTInput.jar
file.reference.jfxrt.jar=${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar
testjfx.run.test.classpath=\
${file.reference.jemmyfx.jar}${path.separator}\