author | chegar |
Tue, 06 Mar 2018 18:43:27 +0000 | |
branch | http-client-branch |
changeset 56253 | 875dbf6234f2 |
parent 48058 | c5eefa465e37 |
child 49293 | 9e1c1889136e |
permissions | -rw-r--r-- |
45227 | 1 |
<!DOCTYPE html> |
2 |
<html> |
|
44511 | 3 |
<head> |
45227 | 4 |
<meta charset="utf-8"> |
5 |
<meta name="generator" content="pandoc"> |
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> |
|
44511 | 7 |
<title>Testing OpenJDK</title> |
8 |
<style type="text/css">code{white-space: pre;}</style> |
|
47217 | 9 |
<link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css"> |
45227 | 10 |
<!--[if lt IE 9]> |
11 |
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> |
|
12 |
<![endif]--> |
|
44511 | 13 |
<style type="text/css">pre, code, tt { color: #1d6ae5; }</style> |
14 |
</head> |
|
15 |
<body> |
|
45227 | 16 |
<header> |
44511 | 17 |
<h1 class="title">Testing OpenJDK</h1> |
45227 | 18 |
</header> |
19 |
<nav id="TOC"> |
|
44511 | 20 |
<ul> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
21 |
<li><a href="#using-the-run-test-framework">Using the run-test framework</a><ul> |
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
22 |
<li><a href="#configuration">Configuration</a></li> |
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
23 |
</ul></li> |
44511 | 24 |
<li><a href="#test-selection">Test selection</a><ul> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
25 |
<li><a href="#jtreg">JTReg</a></li> |
44511 | 26 |
<li><a href="#gtest">Gtest</a></li> |
27 |
</ul></li> |
|
28 |
<li><a href="#test-results-and-summary">Test results and summary</a></li> |
|
29 |
<li><a href="#test-suite-control">Test suite control</a><ul> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
30 |
<li><a href="#jtreg-keywords">JTReg keywords</a></li> |
44511 | 31 |
<li><a href="#gtest-keywords">Gtest keywords</a></li> |
32 |
</ul></li> |
|
33 |
</ul> |
|
45227 | 34 |
</nav> |
44511 | 35 |
<h2 id="using-the-run-test-framework">Using the run-test framework</h2> |
36 |
<p>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.</p> |
|
45266
29347d0c7122
8180651: Make target to run tests on exploded image
erikj
parents:
45103
diff
changeset
|
37 |
<p>The main target "run-test" uses the jdk-image as the tested product. There is also an alternate target "exploded-run-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.</p> |
44511 | 38 |
<p>Some example command-lines:</p> |
39 |
<pre><code>$ make run-test-tier1 |
|
40 |
$ make run-test-jdk_lang JTREG="JOBS=8" |
|
41 |
$ make run-test TEST=jdk_lang |
|
42 |
$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1" |
|
43 |
$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug" |
|
45266
29347d0c7122
8180651: Make target to run tests on exploded image
erikj
parents:
45103
diff
changeset
|
44 |
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" |
29347d0c7122
8180651: Make target to run tests on exploded image
erikj
parents:
45103
diff
changeset
|
45 |
$ make exploded-run-test TEST=hotspot_tier1</code></pre> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
46 |
<h3 id="configuration">Configuration</h3> |
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
47 |
<p>To be able to run JTReg tests, <code>configure</code> needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the <code>--with-jtreg=<path to jtreg home></code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc. (An alternative is to set the <code>JT_HOME</code> environment variable to point to the JTReg home before running <code>configure</code>.)</p> |
44511 | 48 |
<h2 id="test-selection">Test selection</h2> |
49 |
<p>All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.</p> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
50 |
<p>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 <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p> |
44511 | 51 |
<p>The test specifications given in <code>TEST</code> is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, <code>:tier1</code> will expand to <code>jtreg:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1</code>. You can always submit a list of fully qualified test descriptors in the <code>TEST</code> variable if you want to shortcut the parser.</p> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
52 |
<h3 id="jtreg">JTReg</h3> |
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
53 |
<p>JTReg test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot/test:tier1</code>, <code>jdk/test:jdk_util</code>.</p> |
44511 | 54 |
<p>When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.</p> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
55 |
<p>Individual JTReg tests or directories containing JTReg tests can also be specified, like <code>hotspot/test/native_sanity/JniVersion.java</code> or <code>hotspot/test/native_sanity</code>. You can also specify an absolute path, to point to a JTReg test outside the source tree.</p> |
44511 | 56 |
<p>As long as the test groups or test paths can be uniquely resolved, you do not need to enter the <code>jtreg:</code> prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add <code>jtreg:</code>, e.g. <code>jtreg:hotspot/test/native_sanity</code>.</p> |
57 |
<h3 id="gtest">Gtest</h3> |
|
58 |
<p>Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just <code>gtest</code>, or as a fully qualified test descriptor <code>gtest:all</code>.</p> |
|
59 |
<p>If you want, you can single out an individual test or a group of tests, for instance <code>gtest:LogDecorations</code> or <code>gtest:LogDecorations.level_test_vm</code>. This can be particularly useful if you want to run a shaky test repeatedly.</p> |
|
48058
c5eefa465e37
8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents:
47217
diff
changeset
|
60 |
<p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/<variant></code> to the test descriptor, e.g. <code>gtest:Log/client</code>. If you specify no variant, gtest will run once for each JVM variant present (e.g. server, client). So if you only have the server JVM present, then <code>gtest:all</code> will be equivalent to <code>gtest:all/server</code>.</p> |
44511 | 61 |
<h2 id="test-results-and-summary">Test results and summary</h2> |
62 |
<p>At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:</p> |
|
63 |
<pre><code>============================== |
|
64 |
Test summary |
|
65 |
============================== |
|
66 |
TEST TOTAL PASS FAIL ERROR |
|
67 |
>> jtreg:jdk/test:tier1 1867 1865 2 0 << |
|
68 |
jtreg:langtools/test:tier1 4711 4711 0 0 |
|
69 |
jtreg:nashorn/test:tier1 133 133 0 0 |
|
70 |
============================== |
|
71 |
TEST FAILURE</code></pre> |
|
72 |
<p>Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the <code>>> ... <<</code> marker for easy identification.</p> |
|
73 |
<p>The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.</p> |
|
74 |
<p>In case of test failures, <code>make run-test</code> will exit with a non-zero exit value.</p> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
75 |
<p>All tests have their result stored in <code>build/$BUILD/test-results/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p> |
44511 | 76 |
<p>Additional work data is stored in <code>build/$BUILD/test-support/$TEST_ID</code>. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.</p> |
77 |
<h2 id="test-suite-control">Test suite control</h2> |
|
78 |
<p>It is possible to control various aspects of the test suites using make control variables.</p> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
79 |
<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG="JOBS=1;TIMEOUT=8"</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT=8"</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p> |
44511 | 80 |
<p>To separate multiple keyword=value pairs, use <code>;</code> (semicolon). Since the shell normally eats <code>;</code>, the recommended usage is to write the assignment inside qoutes, e.g. <code>JTREG="...;..."</code>. This will also make sure spaces are preserved, as in <code>JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"</code>.</p> |
81 |
<p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT=8</code>. Also, as a special technique, the string <code>%20</code> will be replaced with space for certain options, e.g. <code>JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug</code>. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)</p> |
|
82 |
<p>As far as possible, the names of the keywords have been standardized between test suites.</p> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
83 |
<h3 id="jtreg-keywords">JTReg keywords</h3> |
44511 | 84 |
<h4 id="jobs">JOBS</h4> |
85 |
<p>The test concurrency (<code>-concurrency</code>).</p> |
|
86 |
<p>Defaults to TEST_JOBS (if set by <code>--with-test-jobs=</code>), otherwise it defaults to JOBS, except for Hotspot, where the default is <em>number of CPU cores/2</em>, but never more than 12.</p> |
|
87 |
<h4 id="timeout">TIMEOUT</h4> |
|
88 |
<p>The timeout factor (<code>-timeoutFactor</code>).</p> |
|
89 |
<p>Defaults to 4.</p> |
|
90 |
<h4 id="test_mode">TEST_MODE</h4> |
|
91 |
<p>The test mode (<code>-agentvm</code>, <code>-samevm</code> or <code>-othervm</code>).</p> |
|
92 |
<p>Defaults to <code>-agentvm</code>.</p> |
|
93 |
<h4 id="assert">ASSERT</h4> |
|
94 |
<p>Enable asserts (<code>-ea -esa</code>, or none).</p> |
|
95 |
<p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p> |
|
96 |
<h4 id="verbose">VERBOSE</h4> |
|
97 |
<p>The verbosity level (<code>-verbose</code>).</p> |
|
98 |
<p>Defaults to <code>fail,error,summary</code>.</p> |
|
99 |
<h4 id="retain">RETAIN</h4> |
|
100 |
<p>What test data to retain (<code>-retain</code>).</p> |
|
101 |
<p>Defaults to <code>fail,error</code>.</p> |
|
102 |
<h4 id="max_mem">MAX_MEM</h4> |
|
103 |
<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
104 |
<p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p> |
44511 | 105 |
<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p> |
106 |
<h4 id="options">OPTIONS</h4> |
|
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
107 |
<p>Additional options to the JTReg test framework.</p> |
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
108 |
<p>Use <code>JTREG="OPTIONS=--help all"</code> to see all available JTReg options.</p> |
44511 | 109 |
<h4 id="java_options">JAVA_OPTIONS</h4> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
110 |
<p>Additional Java options to JTReg (<code>-javaoption</code>).</p> |
44511 | 111 |
<h4 id="vm_options">VM_OPTIONS</h4> |
45618
74f490ba783a
8179537: Update testing.md for more clarity regarding JTReg configuration
ihse
parents:
45227
diff
changeset
|
112 |
<p>Additional VM options to JTReg (<code>-vmoption</code>).</p> |
44511 | 113 |
<h3 id="gtest-keywords">Gtest keywords</h3> |
114 |
<h4 id="repeat">REPEAT</h4> |
|
115 |
<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p> |
|
116 |
<p>Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with <code>OPTIONS=--gtest_break_on_failure</code> to reproduce an intermittent problem.</p> |
|
117 |
<h4 id="options-1">OPTIONS</h4> |
|
118 |
<p>Additional options to the Gtest test framework.</p> |
|
119 |
<p>Use <code>GTEST="OPTIONS=--help"</code> to see all available Gtest options.</p> |
|
120 |
</body> |
|
121 |
</html> |