8080275: transparently download testng.jar for Nashorn testing

Tue, 02 Jun 2015 14:35:03 +0200

author
mhaupt
date
Tue, 02 Jun 2015 14:35:03 +0200
changeset 1391
7b10faf739fd
parent 1390
556876366259
child 1392
ba519ec9ec82

8080275: transparently download testng.jar for Nashorn testing
Summary: Instead of asking the user to manually download and install testng.jar, automate the process via "ant externals".
Reviewed-by: hannesw, sundar

README file | annotate | diff | comparison | revisions
make/build.xml file | annotate | diff | comparison | revisions
make/project.properties file | annotate | diff | comparison | revisions
     1.1 --- a/README	Tue Jun 02 14:34:37 2015 +0200
     1.2 +++ b/README	Tue Jun 02 14:35:03 2015 +0200
     1.3 @@ -72,14 +72,11 @@
     1.4  - Running tests
     1.5  
     1.6  Nashorn tests are TestNG based. Running tests requires downloading the
     1.7 -TestNG library and placing its jar file into the lib subdirectory:
     1.8 +TestNG library and placing its jar file into the test/lib subdirectory. This is
     1.9 +done automatically when executing the "ant externals" command to get external
    1.10 +test suites (see below).
    1.11  
    1.12 -    # download and install TestNG
    1.13 -    wget http://testng.org/testng-x.y.z.zip
    1.14 -    unzip testng-x.y.z.zip
    1.15 -    cp testng-x.y.z/testng-x.y.z.jar test/lib/testng.jar
    1.16 -    
    1.17 -After that, you can run the tests using:
    1.18 +Once TestNG is properly installed, you can run the tests using:
    1.19      cd make
    1.20      ant clean test
    1.21      
     2.1 --- a/make/build.xml	Tue Jun 02 14:34:37 2015 +0200
     2.2 +++ b/make/build.xml	Tue Jun 02 14:35:03 2015 +0200
     2.3 @@ -1,7 +1,7 @@
     2.4  <?xml version="1.0" encoding="UTF-8"?>
     2.5  
     2.6  <!--
     2.7 - Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     2.8 + Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2.9   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    2.10  
    2.11   This code is free software; you can redistribute it and/or modify it
    2.12 @@ -388,7 +388,7 @@
    2.13    </target>
    2.14  
    2.15    <target name="check-testng" unless="testng.available">
    2.16 -    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
    2.17 +    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/>
    2.18    </target>
    2.19  
    2.20    <!-- only to be invoked as dependency of "test" target -->
    2.21 @@ -685,7 +685,7 @@
    2.22    </target>
    2.23  
    2.24    <!-- get all external test scripts -->
    2.25 -  <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
    2.26 +  <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider, get-testng">
    2.27      <!-- make external test dir -->
    2.28      <mkdir dir="${test.external.dir}"/>
    2.29  
    2.30 @@ -726,6 +726,18 @@
    2.31       <fail message="Exiting.."/>
    2.32    </target>
    2.33  
    2.34 +  <!-- download and install testng.jar -->
    2.35 +  <target name="get-testng" unless="testng.available">
    2.36 +    <get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
    2.37 +    <unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}">
    2.38 +      <patternset>
    2.39 +        <include name="testng-6.8/testng-6.8.jar"/>
    2.40 +      </patternset>
    2.41 +    </unzip>
    2.42 +    <move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/>
    2.43 +    <delete dir="${test.lib}${file.separator}testng-6.8"/>
    2.44 +  </target>
    2.45 +
    2.46    <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
    2.47  
    2.48    <import file="build-benchmark.xml"/>
     3.1 --- a/make/project.properties	Tue Jun 02 14:34:37 2015 +0200
     3.2 +++ b/make/project.properties	Tue Jun 02 14:35:03 2015 +0200
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  # 
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -77,8 +77,11 @@
    3.11  # configuration for java flight recorder
    3.12  run.test.jvmargs.jfr=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128
    3.13  
    3.14 +# test library location
    3.15 +test.lib=${basedir}${file.separator}test${file.separator}lib
    3.16 +
    3.17  # jars refererred
    3.18 -file.reference.testng.jar=test/lib/testng.jar
    3.19 +file.reference.testng.jar=${test.lib}${file.separator}testng.jar
    3.20  
    3.21  # Set testng verbose level
    3.22  # From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed) 
    3.23 @@ -237,9 +240,9 @@
    3.24      -fx \
    3.25      ${test.script.dir}${file.separator}jfx.js
    3.26  
    3.27 -file.reference.jemmyfx.jar=test${file.separator}lib${file.separator}JemmyFX.jar
    3.28 -file.reference.jemmycore.jar=test${file.separator}lib${file.separator}JemmyCore.jar
    3.29 -file.reference.jemmyawtinput.jar=test${file.separator}lib${file.separator}JemmyAWTInput.jar
    3.30 +file.reference.jemmyfx.jar=${test.lib}${file.separator}JemmyFX.jar
    3.31 +file.reference.jemmycore.jar=${test.lib}${file.separator}JemmyCore.jar
    3.32 +file.reference.jemmyawtinput.jar=${test.lib}${file.separator}JemmyAWTInput.jar
    3.33  file.reference.jfxrt.jar=${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar
    3.34  testjfx.run.test.classpath=\
    3.35      ${file.reference.jemmyfx.jar}${path.separator}\

mercurial