Install Jtreg

Version 1

    Install JTReg

    NOTE: $SOURCE_CODE is where you installed the source code to. If you are using the Pre packaged VM then this is /home/openjdk/sources If you are using Your own Environment then it's likely to be something like /home/<your username>/sources

    Download and install jtreg

    1. Go to http://openjdk.java.net/jtreg/ and have a scan through the details there
      1. jtreg concurrency tests and jtreg writing tests contain further useful information
    2. Go to https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastSuccessfulBuild/artifact/ (previous source: http://download.java.net/openjdk/jtreg/) and download the latest binary zip file
    3. Unzip the contents to $JTREG_INSTALL
      1. If you are using the Adopt OpenJDK VM Build this should be the /home/openjdk/jtreg directory

    Configure jtreg

    Debian/Ubuntu

    Execute the following:

     vi ~/.bashrc 

    And append (replacing $JTREG_INSTALL and $SOURCE_CODE as appropriate):

     export SOURCE_CODE=$HOME/sources export JTREG_INSTALL=<location of where JTREG has been installed> export JT_HOME=$JTREG_INSTALL export JTREG_HOME=$JTREG_INSTALL export PRODUCT_HOME=$SOURCE_CODE/jdk9/build/linux-x64-normal-server-release/images/j2sdk-image export JPRT_JTREG_HOME=${JT_HOME} export JPRT_JAVA_HOME=${PRODUCT_HOME} export JTREG_TIMEOUT_FACTOR=5 export CONCURRENCY=4 

    NOTE:: CONCURRENCY should be set to a number that your CPU machine can comfortably deal with, i.e. The number of cores.

    NOTE:: The name of the sub-folder under $SOURCE_CODE/jdk9/build/ folder can have other variants e.g. linux-x86_64-normal-server-release, so please check for this in your build environment before applying the above env settings.

    Then source the new default environment settings (important)

     source ~/.bashrc ; 

    Check if the above command has had an effect by echoing one of the above variables, at the CLI.

    OLD_BUILD

    If you are using the Old_Build then the PRODUCT_HOME will be slightly different

     export PRODUCT_HOME=$SOURCE_CODE/jdk9/build/linux-amd64_backup/j2sdk-image 

    MS Windows

    Edit the Windows System Environment Variables found under Control Panel / System and Security / System / Advanced System Settings

    Add the following new System Properties if not exist (replacing $JTREG_INSTALL and $JAVA_HOME as appropriate using the Windows Path as C:\xxx ):

     JAVA_HOME=$JAVA_HOME JT_HOME=$JTREG_INSTALL 

    Edit the PATH Environment Variable by appending:

     <existing path>;%JAVA_HOME%\bin;%JT_HOME%\win32\bin 

    Mac OS X

    Execute the following:

     vi ~/.bashrc 

    And append (replacing $JTREG_INSTALL and $SOURCE_CODE as appropriate):

     export JT_HOME=$JTREG_INSTALL export PRODUCT_HOME=$SOURCE_CODE/jdk9/build/macosx-x64-normal-server-release/images/j2sdk-image 

    NOTE: The name of the sub-folder under $SOURCE_CODE/jdk9/build/ folder can have other variants e.g.. macosx-x86_64-normal-server-release, so please check for this in your build environment before applying the above env settings.

    Then source the new default env settings

     source ~/.bashrc ; 

    Sanity check jtreg

    Execute the following

     cd $SOURCE_CODE ; cd jdk9/test ; make jdk_util &> test.log ; 

    This should take some time to execute if it is working correctly. If it executes too quickly you may want to check the output using a command such as:

     less test.log 

    Running tests via the CLI

    In the new build system tests can be run from the $SOURCE_CODE/jdk9/test folder by performing the below actions:

     make test TEST=[test], where [test] is one or more components to test 

    for e.g.,

     make test TEST="jdk_lang jdk_net"  

    or to run a single test package / sub-package:

     make jdk_io  

    or to run all test packages:

     make jdk_all  

    or to run a single unit test, when jtreg is installed (see How to build JTReg in Eclipse (for Ubuntu 12.04 LTS) before running the below):

     [path/to]/jtreg [options] [ -jdk:<java.home> ] [unit test name and location] (use the -jdk:<java.home> option, if JAVA_HOME points to JDK version lower than 1.7) 

    for e.g.

     cd $HOME/sources/jdk9/jdk/test $HOME/jtreg/linux/bin/jtreg -verbose:fail java/lang/invoke/AccessControlTest.java 

     

    Download jcommand.jar by doing the below if jtreg is expecting it for tests:

     $ cd $HOME/jtreg/lib/ $ wget http://repo1.maven.org/maven2/com/beust/jcommander/1.7/jcommander-1.7.jar 

    for e.g.

     [path/to]/jtreg [options] [ -jdk:<java.home> ]  [ -cpa: $HOME/jtreg/lib/jcommander-1.7.jar ]  [ unit test name and location ] 


    Here are some more components that can be used:

     jdk_all jdk_default jdk_core  langtools_jtreg  jdk_beans1 jdk_io jdk_lang jdk_math jdk_other jdk_net jdk_nio jdk_security1 jdk_text jdk_util jdk_time jdk_awt jdk_beans2 jdk_beans3 jdk_management jdk_jmx jdk_security2 jdk_security3 jdk_rmi jdk_sound jdk_swing jdk_tools jdk_jdi jdk_jfr 

    The below rules might be present in the $SOURCE_CODE/jdk9/test/Makefile file but were only put there for Oracle's internal use and experimental purposes only and hence should not be used:

     jck7devtools jck7compiler jck7runtime 

    Also additional access is required to work with these, as they do not directly form part of the OpenJDK project.

    Install runJtregTests.sh script

    To aid in running jtreg you can install the runJtregTests.sh script

     cd $SOURCE_CODE ; cd jdk9/test ; wget https://raw.github.com/AdoptOpenJDK/BuildHelpers/master/runJtregTests.sh ; chmod u+x runJtregTests.sh ; 

    Install IDE Support

     

    IDE / OSWindowsLinuxMac OS X
    EclipseTBAYesTBA
    NetbeansTBAPendingTBA
    IntelliJTBATBATBA

     

    JTREG Tutorials

    See JTreg Tutorials for guided video tutorials!

    How to build JTReg in Eclipse (for Ubuntu 12.04 LTS)

    See How to build JTReg in Eclipse (for Ubuntu 12.04 LTS)