common/doc/testing.html
author ihse
Fri, 12 May 2017 19:09:50 +0200
changeset 45103 85999d3d05f0
parent 44511 f3c27401a860
child 45266 29347d0c7122
child 45227 97be1bcd7b25
permissions -rw-r--r--
8175825: Stop including pubs repo Reviewed-by: erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44511
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     2
<html xmlns="http://www.w3.org/1999/xhtml">
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     3
<head>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     5
  <meta http-equiv="Content-Style-Type" content="text/css" />
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     6
  <meta name="generator" content="pandoc" />
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     7
  <title>Testing OpenJDK</title>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
     8
  <style type="text/css">code{white-space: pre;}</style>
45103
85999d3d05f0 8175825: Stop including pubs repo
ihse
parents: 44511
diff changeset
     9
  <link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
44511
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    10
  <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    11
</head>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    12
<body>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    13
<div id="header">
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    14
<h1 class="title">Testing OpenJDK</h1>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    15
</div>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    16
<div id="TOC">
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    17
<ul>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    18
<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    19
<li><a href="#test-selection">Test selection</a><ul>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    20
<li><a href="#jtreg">JTreg</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    21
<li><a href="#gtest">Gtest</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    22
</ul></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    23
<li><a href="#test-results-and-summary">Test results and summary</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    24
<li><a href="#test-suite-control">Test suite control</a><ul>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    25
<li><a href="#jtreg-keywords">JTreg keywords</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    26
<li><a href="#gtest-keywords">Gtest keywords</a></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    27
</ul></li>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    28
</ul>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    29
</div>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    30
<h2 id="using-the-run-test-framework">Using the run-test framework</h2>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    31
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    32
<p>Some example command-lines:</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    33
<pre><code>$ make run-test-tier1
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    34
$ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    35
$ make run-test TEST=jdk_lang
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    36
$ make run-test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    37
$ make run-test TEST=&quot;hotspot/test:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    38
$ make run-test TEST=&quot;jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java&quot;</code></pre>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    39
<h2 id="test-selection">Test selection</h2>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    40
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    41
<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=&quot;tier1&quot;</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST=&quot;x&quot;</code> solution needs to be used.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    42
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    43
<h3 id="jtreg">JTreg</h3>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    44
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    45
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    46
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    47
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    48
<h3 id="gtest">Gtest</h3>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    49
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    50
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    51
<h2 id="test-results-and-summary">Test results and summary</h2>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    52
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    53
<pre><code>==============================
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    54
Test summary
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    55
==============================
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    56
   TEST                                          TOTAL  PASS  FAIL ERROR
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    57
&gt;&gt; jtreg:jdk/test:tier1                           1867  1865     2     0 &lt;&lt;
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    58
   jtreg:langtools/test:tier1                     4711  4711     0     0
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    59
   jtreg:nashorn/test:tier1                        133   133     0     0
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    60
==============================
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    61
TEST FAILURE</code></pre>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    62
<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>&gt;&gt; ... &lt;&lt;</code> marker for easy identification.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    63
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    64
<p>In case of test failures, <code>make run-test</code> will exit with a non-zero exit value.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    65
<p>All tests have their result stored in <code>build/$BUILD/test-result/$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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    66
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    67
<h2 id="test-suite-control">Test suite control</h2>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    68
<p>It is possible to control various aspects of the test suites using make control variables.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    69
<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG=&quot;JOBS=1;TIMEOUT=8&quot;</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=&quot;TMIEOUT=8&quot;</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    70
<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=&quot;...;...&quot;</code>. This will also make sure spaces are preserved, as in <code>JTREG=&quot;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;</code>.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    71
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    72
<p>As far as possible, the names of the keywords have been standardized between test suites.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    73
<h3 id="jtreg-keywords">JTreg keywords</h3>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    74
<h4 id="jobs">JOBS</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    75
<p>The test concurrency (<code>-concurrency</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    76
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    77
<h4 id="timeout">TIMEOUT</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    78
<p>The timeout factor (<code>-timeoutFactor</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    79
<p>Defaults to 4.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    80
<h4 id="test_mode">TEST_MODE</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    81
<p>The test mode (<code>-agentvm</code>, <code>-samevm</code> or <code>-othervm</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    82
<p>Defaults to <code>-agentvm</code>.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    83
<h4 id="assert">ASSERT</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    84
<p>Enable asserts (<code>-ea -esa</code>, or none).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    85
<p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    86
<h4 id="verbose">VERBOSE</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    87
<p>The verbosity level (<code>-verbose</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    88
<p>Defaults to <code>fail,error,summary</code>.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    89
<h4 id="retain">RETAIN</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    90
<p>What test data to retain (<code>-retain</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    91
<p>Defaults to <code>fail,error</code>.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    92
<h4 id="max_mem">MAX_MEM</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    93
<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    94
<p>Limit memory consumption for JTreg test framework and VM under test. Set to 0 to disable the limits.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    95
<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    96
<h4 id="options">OPTIONS</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    97
<p>Additional options to the JTreg test framework.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    98
<p>Use <code>JTREG=&quot;OPTIONS=--help all&quot;</code> to see all available JTreg options.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
    99
<h4 id="java_options">JAVA_OPTIONS</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   100
<p>Additional Java options to JTreg (<code>-javaoption</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   101
<h4 id="vm_options">VM_OPTIONS</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   102
<p>Additional VM options to JTreg (<code>-vmoption</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   103
<h3 id="gtest-keywords">Gtest keywords</h3>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   104
<h4 id="repeat">REPEAT</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   105
<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   106
<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>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   107
<h4 id="options-1">OPTIONS</h4>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   108
<p>Additional options to the Gtest test framework.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   109
<p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   110
</body>
f3c27401a860 8177955: Add testing documentation
ihse
parents:
diff changeset
   111
</html>