--- old/doc/testing.html 2019-04-04 11:01:01.312341306 +0800 +++ new/doc/testing.html 2019-04-04 11:01:01.108341661 +0800 @@ -1,24 +1,29 @@ - +
This new way of running tests is developer-centric. It assumes that you have built a JDK locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.
The main target test uses the jdk-image as the tested product. There is also an alternate target exploded-test that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.
test
exploded-test
Previously, make test was used to invoke an old system for running tests, and make run-test was used for the new test framework. For backward compatibility with scripts and muscle memory, run-test (and variants like exploded-run-test or run-test-tier1) are kept as aliases.
make test
make run-test
run-test
exploded-run-test
run-test-tier1
To be able to run microbenchmarks, configure needs to know where to find the JMH dependency. Use --with-jmh=<path to JMH jars> to point to a directory containing the core JMH and transitive dependencies. The recommended dependencies can be retrieved by running sh make/devkit/createJMHBundle.sh, after which --with-jmh=build/jmh/jars should work.
configure
--with-jmh=<path to JMH jars>
sh make/devkit/createJMHBundle.sh
--with-jmh=build/jmh/jars
All functionality is available using the test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, test-only can be used instead, which do not depend on the source and test image build.
TEST
test-only
For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that make test-tier1 is equivalent to make test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the test TEST="x" solution needs to be used.
make test-tier1
make test TEST="tier1"
test TEST="x"
The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1. You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.
:tier1
jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1
JTReg tests can be selected either by picking a JTReg test group, or a selection of files or directories containing JTReg tests.
Additional work data is stored in build/$BUILD/test-support/$TEST_ID. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.
build/$BUILD/test-support/$TEST_ID
It is possible to control various aspects of the test suites using make control variables.
These variables use a keyword=value approach to allow multiple values to be set. So, for instance, JTREG="JOBS=1;TIMEOUT=8" will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting JTREG_JOBS=1 JTREG_TIMEOUT=8, but using the keyword format means that the JTREG variable is parsed and verified for correctness, so JTREG="TMIEOUT=8" would give an error, while JTREG_TMIEOUT=8 would just pass unnoticed.
JTREG="JOBS=1;TIMEOUT=8"
JTREG_JOBS=1 JTREG_TIMEOUT=8
JTREG
JTREG="TMIEOUT=8"
JTREG_TMIEOUT=8
To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug".
;
JTREG="...;..."
JTREG="VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug"
(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)
JTREG=JOBS=1\;TIMEOUT=8
%20
JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug
As far as possible, the names of the keywords have been standardized between test suites.
The file names should be either absolute, or relative to the JTReg test root of the tests to be run.
Additional options to the JTReg test framework.
Use JTREG="OPTIONS=--help all" to see all available JTReg options.
JTREG="OPTIONS=--help all"
Additional Java options to JTReg (-javaoption).
-javaoption
Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with OPTIONS=--gtest_break_on_failure to reproduce an intermittent problem.
OPTIONS=--gtest_break_on_failure
Additional options to the Gtest test framework.
Use GTEST="OPTIONS=--help" to see all available Gtest options.
GTEST="OPTIONS=--help"
Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value %20).
Additional VM arguments to provide to forked off VMs. Same as -jvmArgs <args>
-jvmArgs <args>
Additional arguments to send to JMH.
Docker tests with default parameters may fail on the os newer than oraclelinux 7.6. For example, it is passed on Ubuntu 16.04 but failed on Ubuntu 18.04 with
$ make test TEST="jtreg:test/hotspot/jtreg/runtime/containers/docker"
To run these tests correctly, additional parameters for the correct docker image are required on Ubuntu 18.04 by using JAVA_OPTIONS.
JAVA_OPTIONS
$ make test TEST="jtreg:test/hotspot/jtreg/runtime/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"