There are currently 2 supported test procedures. Select the one that best suits your neeeds.
- Testing locally. Choose this if you have build & test dependencies set up.
- Testing in Docker. Choose this if you don't want to deal with build & test dependency setups.
These are the steps to run the tests on your machine.
-
Compile a build of openj9 from scratch. (Optional: compile a debug build if you need it. To do this pass the flag
--with-debug-level=slowdebug
toconfigure
. Please note that debug build is much slower and the tests will take very long time to finish). -
Install prerequisites
An example of how to install the prerequisites can be found here. Make sure that JAVA_HOME and JAVA_BIN are set (E.g.
export JAVA_HOME=/root/openj9-openjdk-jdk11/build/linux-x86_64-normal-server-release/images/jdk
andexport JAVA_BIN=/root/openj9-openjdk-jdk11/build/linux-x86_64-normal-server-release/images/jdk/bin
). Basically you want to test on the jdk you build, so point the environment variable to your personal build of jdk. -
Compile the tests (only need to compile once):
cd $OPENJ9_DIR/openj9/test git clone https://github.com/adoptium/TKG.git cd TKG export TEST_JDK_HOME=<path to JDK directory that you wish to test, it's the same as $JAVA_HOME> export JAVA_BIN=/your/sdk/jre/bin export SPEC=linux_x86-64_cmprssptrs
Either
TEST_FLAGS
orEXTRA_OPTIONS
can be used to run tests with JITServer. The following will launch both the server and the client during the test.export TEST_FLAG="JITAAS"
The following sets up only the client side which requires manually starting the server before running the test.
export EXTRA_OPTIONS=" -XX:+UseJITServer " # spaces at the start and end are important!
NOTE: It's important to put spaces before and after
-XX:+UseJITServer
, otherwise some tests will not run properly.Set the path to native test libraries, otherwise some tests will not run properly
export NATIVE_TEST_LIBS=/root/buildname/openj9-openjdk-jdk8/build/linux-x86_64-normal-server-release/images/test/openj9
Compile the test
make compile
NOTE: to compile and run tests, ant-contrib.jar is needed, and on some systems just installing ant will not install ant-contrib. On Ubuntu, the easiest way to get it is to run:
sudo apt-get install ant-contrib
-
Run the tests!
Manually start the server if
JITAAS
TEST_FLAG is not used.$JAVA_BIN/jitserver
make _sanity
-
To rerun the failed tests, run
make _failed
which tests will be rerun can be modified in
failedtargets.mk
.or, if you want to run an individual test, run
make <name_of_the_test>
For more advanced testing features, refer to this guide.