< prev index next >

doc/testing.html

Print this page


   1 <!DOCTYPE html>
   2 <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
   3 <head>
   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" />
   7   <title>Testing the JDK</title>
   8   <style type="text/css">
   9       code{white-space: pre-wrap;}
  10       span.smallcaps{font-variant: small-caps;}
  11       span.underline{text-decoration: underline;}
  12       div.column{display: inline-block; vertical-align: top; width: 50%;}
  13   </style>
  14   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css" />
  15   <!--[if lt IE 9]>
  16     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  17   <![endif]-->
  18   <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
  19 </head>
  20 <body>
  21 <header id="title-block-header">
  22 <h1 class="title">Testing the JDK</h1>
  23 </header>
  24 <nav id="TOC">
  25 <ul>
  26 <li><a href="#using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</a><ul>
  27 <li><a href="#configuration">Configuration</a></li>
  28 </ul></li>
  29 <li><a href="#test-selection">Test selection</a><ul>
  30 <li><a href="#jtreg">JTReg</a></li>
  31 <li><a href="#gtest">Gtest</a></li>
  32 <li><a href="#microbenchmarks">Microbenchmarks</a></li>
  33 <li><a href="#special-tests">Special tests</a></li>
  34 </ul></li>
  35 <li><a href="#test-results-and-summary">Test results and summary</a></li>
  36 <li><a href="#test-suite-control">Test suite control</a><ul>
  37 <li><a href="#general-keywords-test_opts">General keywords (TEST_OPTS)</a></li>
  38 <li><a href="#jtreg-keywords">JTReg keywords</a></li>
  39 <li><a href="#gtest-keywords">Gtest keywords</a></li>
  40 <li><a href="#microbenchmark-keywords">Microbenchmark keywords</a></li>
  41 </ul></li>
  42 <li><a href="#notes-for-specific-tests">Notes for Specific Tests</a><ul>
  43 <li><a href="#docker-tests">Docker Tests</a></li>
  44 <li><a href="#non-us-locale">Non-US locale</a></li>
  45 </ul></li>
  46 </ul>
  47 </nav>
  48 <h2 id="using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</h2>
  49 <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>
  50 <p>The main target <code>test</code> uses the jdk-image as the tested product. There is also an alternate target <code>exploded-test</code> 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>
  51 <p>Previously, <code>make test</code> was used to invoke an old system for running tests, and <code>make run-test</code> was used for the new test framework. For backward compatibility with scripts and muscle memory, <code>run-test</code> (and variants like <code>exploded-run-test</code> or <code>run-test-tier1</code>) are kept as aliases.</p>
  52 <p>Some example command-lines:</p>
  53 <pre><code>$ make test-tier1
  54 $ make test-jdk_lang JTREG=&quot;JOBS=8&quot;
  55 $ make test TEST=jdk_lang
  56 $ make test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
  57 $ make test TEST=&quot;hotspot:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
  58 $ make test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
  59 $ make test TEST=&quot;micro:java.lang.reflect&quot; MICRO=&quot;FORK=1;WARMUP_ITER=2&quot;
  60 $ make exploded-test TEST=tier2</code></pre>
  61 <h3 id="configuration">Configuration</h3>
  62 <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=&lt;path to jtreg home&gt;</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>
  63 <p>To be able to run microbenchmarks, <code>configure</code> needs to know where to find the JMH dependency. Use <code>--with-jmh=&lt;path to JMH jars&gt;</code> to point to a directory containing the core JMH and transitive dependencies. The recommended dependencies can be retrieved by running <code>sh make/devkit/createJMHBundle.sh</code>, after which <code>--with-jmh=build/jmh/jars</code> should work.</p>
  64 <h2 id="test-selection">Test selection</h2>
  65 <p>All functionality is available using the <code>test</code> 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, <code>test-only</code> can be used instead, which do not depend on the source and test image build.</p>


 137 <p>Defaults to <code>-agentvm</code>.</p>
 138 <h4 id="assert">ASSERT</h4>
 139 <p>Enable asserts (<code>-ea -esa</code>, or none).</p>
 140 <p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p>
 141 <h4 id="verbose">VERBOSE</h4>
 142 <p>The verbosity level (<code>-verbose</code>).</p>
 143 <p>Defaults to <code>fail,error,summary</code>.</p>
 144 <h4 id="retain">RETAIN</h4>
 145 <p>What test data to retain (<code>-retain</code>).</p>
 146 <p>Defaults to <code>fail,error</code>.</p>
 147 <h4 id="max_mem">MAX_MEM</h4>
 148 <p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
 149 <p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
 150 <p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
 151 <h4 id="keywords">KEYWORDS</h4>
 152 <p>JTReg kewords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
 153 <h4 id="extra_problem_lists">EXTRA_PROBLEM_LISTS</h4>
 154 <p>Use additional problem lists file or files, in addition to the default ProblemList.txt located at the JTReg test roots.</p>
 155 <p>If multiple file names are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
 156 <p>The file names should be either absolute, or relative to the JTReg test root of the tests to be run.</p>
 157 <h4 id="run_problem_lists">RUN_PROBLEM_LISTS</h4>
 158 <p>Use the problem lists to select tests instead of excluding them.</p>
 159 <p>Set to <code>true</code> or <code>false</code>. If <code>true</code>, JTReg will use <code>-match:</code> option, otherwise <code>-exclude:</code> will be used. Default is <code>false</code>.</p>
 160 <h4 id="options">OPTIONS</h4>
 161 <p>Additional options to the JTReg test framework.</p>
 162 <p>Use <code>JTREG=&quot;OPTIONS=--help all&quot;</code> to see all available JTReg options.</p>
 163 <h4 id="java_options-1">JAVA_OPTIONS</h4>
 164 <p>Additional Java options to JTReg (<code>-javaoption</code>).</p>
 165 <h4 id="vm_options-1">VM_OPTIONS</h4>
 166 <p>Additional VM options to JTReg (<code>-vmoption</code>).</p>
 167 <h4 id="aot_modules-1">AOT_MODULES</h4>
 168 <p>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 <code>%20</code>).</p>
 169 <h3 id="gtest-keywords">Gtest keywords</h3>
 170 <h4 id="repeat">REPEAT</h4>
 171 <p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
 172 <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>
 173 <h4 id="options-1">OPTIONS</h4>
 174 <p>Additional options to the Gtest test framework.</p>
 175 <p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
 176 <h4 id="aot_modules-2">AOT_MODULES</h4>
 177 <p>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 <code>%20</code>).</p>
 178 <h3 id="microbenchmark-keywords">Microbenchmark keywords</h3>
 179 <h4 id="fork">FORK</h4>
 180 <p>Override the number of benchmark forks to spawn. Same as specifying <code>-f &lt;num&gt;</code>.</p>
 181 <h4 id="iter">ITER</h4>
 182 <p>Number of measurement iterations per fork. Same as specifying <code>-i &lt;num&gt;</code>.</p>
 183 <h4 id="time">TIME</h4>
 184 <p>Amount of time to spend in each measurement iteration, in seconds. Same as specifying <code>-r &lt;num&gt;</code></p>
 185 <h4 id="warmup_iter">WARMUP_ITER</h4>
 186 <p>Number of warmup iterations to run before the measurement phase in each fork. Same as specifying <code>-wi &lt;num&gt;</code>.</p>
 187 <h4 id="warmup_time">WARMUP_TIME</h4>
 188 <p>Amount of time to spend in each warmup iteration. Same as specifying <code>-w &lt;num&gt;</code>.</p>
 189 <h4 id="results_format">RESULTS_FORMAT</h4>
 190 <p>Specify to have the test run save a log of the values. Accepts the same values as <code>-rff</code>, i.e., <code>text</code>, <code>csv</code>, <code>scsv</code>, <code>json</code>, or <code>latex</code>.</p>
 191 <h4 id="vm_options-2">VM_OPTIONS</h4>
 192 <p>Additional VM arguments to provide to forked off VMs. Same as <code>-jvmArgs &lt;args&gt;</code></p>
 193 <h4 id="options-2">OPTIONS</h4>
 194 <p>Additional arguments to send to JMH.</p>
 195 <h2 id="notes-for-specific-tests">Notes for Specific Tests</h2>
 196 <h3 id="docker-tests">Docker Tests</h3>
 197 <p>Docker tests with default parameters may fail on systems with glibc versions not compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:</p>
 198 <pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot;</code></pre>
 199 <p>To run these tests correctly, additional parameters for the correct docker image are required on Ubuntu 18.04 by using <code>JAVA_OPTIONS</code>.</p>
 200 <pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot; JTREG=&quot;JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest&quot;</code></pre>
 201 <h3 id="non-us-locale">Non-US locale</h3>
 202 <p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG=&quot;en_US&quot;</code> in the environment before running tests should work. On Windows, setting <code>JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot;</code> helps for most, but not all test cases. For example:</p>
 203 <pre><code>$ export LANG=&quot;en_US&quot; &amp;&amp; make test TEST=...
 204 $ make test JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot; TEST=...</code></pre>
 205 </body>
 206 </html>
   1 <!DOCTYPE html>
   2 <html>
   3 <head>
   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">
   7   <title>Testing the JDK</title>
   8   <style type="text/css">code{white-space: pre;}</style>
   9   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css">





  10   <!--[if lt IE 9]>
  11     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  12   <![endif]-->
  13   <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
  14 </head>
  15 <body>
  16 <header>
  17 <h1 class="title">Testing the JDK</h1>
  18 </header>
  19 <nav id="TOC">
  20 <ul>
  21 <li><a href="#using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</a><ul>
  22 <li><a href="#configuration">Configuration</a></li>
  23 </ul></li>
  24 <li><a href="#test-selection">Test selection</a><ul>
  25 <li><a href="#jtreg">JTReg</a></li>
  26 <li><a href="#gtest">Gtest</a></li>
  27 <li><a href="#microbenchmarks">Microbenchmarks</a></li>
  28 <li><a href="#special-tests">Special tests</a></li>
  29 </ul></li>
  30 <li><a href="#test-results-and-summary">Test results and summary</a></li>
  31 <li><a href="#test-suite-control">Test suite control</a><ul>
  32 <li><a href="#general-keywords-test_opts">General keywords (TEST_OPTS)</a></li>
  33 <li><a href="#jtreg-keywords">JTReg keywords</a></li>
  34 <li><a href="#gtest-keywords">Gtest keywords</a></li>
  35 <li><a href="#microbenchmark-keywords">Microbenchmark keywords</a></li>
  36 </ul></li>




  37 </ul>
  38 </nav>
  39 <h2 id="using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</h2>
  40 <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>
  41 <p>The main target <code>test</code> uses the jdk-image as the tested product. There is also an alternate target <code>exploded-test</code> 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>
  42 <p>Previously, <code>make test</code> was used to invoke an old system for running tests, and <code>make run-test</code> was used for the new test framework. For backward compatibility with scripts and muscle memory, <code>run-test</code> (and variants like <code>exploded-run-test</code> or <code>run-test-tier1</code>) are kept as aliases.</p>
  43 <p>Some example command-lines:</p>
  44 <pre><code>$ make test-tier1
  45 $ make test-jdk_lang JTREG=&quot;JOBS=8&quot;
  46 $ make test TEST=jdk_lang
  47 $ make test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
  48 $ make test TEST=&quot;hotspot:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
  49 $ make test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
  50 $ make test TEST=&quot;micro:java.lang.reflect&quot; MICRO=&quot;FORK=1;WARMUP_ITER=2&quot;
  51 $ make exploded-test TEST=tier2</code></pre>
  52 <h3 id="configuration">Configuration</h3>
  53 <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=&lt;path to jtreg home&gt;</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>
  54 <p>To be able to run microbenchmarks, <code>configure</code> needs to know where to find the JMH dependency. Use <code>--with-jmh=&lt;path to JMH jars&gt;</code> to point to a directory containing the core JMH and transitive dependencies. The recommended dependencies can be retrieved by running <code>sh make/devkit/createJMHBundle.sh</code>, after which <code>--with-jmh=build/jmh/jars</code> should work.</p>
  55 <h2 id="test-selection">Test selection</h2>
  56 <p>All functionality is available using the <code>test</code> 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, <code>test-only</code> can be used instead, which do not depend on the source and test image build.</p>


 128 <p>Defaults to <code>-agentvm</code>.</p>
 129 <h4 id="assert">ASSERT</h4>
 130 <p>Enable asserts (<code>-ea -esa</code>, or none).</p>
 131 <p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p>
 132 <h4 id="verbose">VERBOSE</h4>
 133 <p>The verbosity level (<code>-verbose</code>).</p>
 134 <p>Defaults to <code>fail,error,summary</code>.</p>
 135 <h4 id="retain">RETAIN</h4>
 136 <p>What test data to retain (<code>-retain</code>).</p>
 137 <p>Defaults to <code>fail,error</code>.</p>
 138 <h4 id="max_mem">MAX_MEM</h4>
 139 <p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
 140 <p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
 141 <p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
 142 <h4 id="keywords">KEYWORDS</h4>
 143 <p>JTReg kewords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
 144 <h4 id="extra_problem_lists">EXTRA_PROBLEM_LISTS</h4>
 145 <p>Use additional problem lists file or files, in addition to the default ProblemList.txt located at the JTReg test roots.</p>
 146 <p>If multiple file names are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
 147 <p>The file names should be either absolute, or relative to the JTReg test root of the tests to be run.</p>



 148 <h4 id="options">OPTIONS</h4>
 149 <p>Additional options to the JTReg test framework.</p>
 150 <p>Use <code>JTREG=&quot;OPTIONS=--help all&quot;</code> to see all available JTReg options.</p>
 151 <h4 id="java_options-1">JAVA_OPTIONS</h4>
 152 <p>Additional Java options to JTReg (<code>-javaoption</code>).</p>
 153 <h4 id="vm_options-1">VM_OPTIONS</h4>
 154 <p>Additional VM options to JTReg (<code>-vmoption</code>).</p>
 155 <h4 id="aot_modules-1">AOT_MODULES</h4>
 156 <p>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 <code>%20</code>).</p>
 157 <h3 id="gtest-keywords">Gtest keywords</h3>
 158 <h4 id="repeat">REPEAT</h4>
 159 <p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
 160 <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>
 161 <h4 id="options-1">OPTIONS</h4>
 162 <p>Additional options to the Gtest test framework.</p>
 163 <p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
 164 <h4 id="aot_modules-2">AOT_MODULES</h4>
 165 <p>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 <code>%20</code>).</p>
 166 <h3 id="microbenchmark-keywords">Microbenchmark keywords</h3>
 167 <h4 id="fork">FORK</h4>
 168 <p>Override the number of benchmark forks to spawn. Same as specifying <code>-f &lt;num&gt;</code>.</p>
 169 <h4 id="iter">ITER</h4>
 170 <p>Number of measurement iterations per fork. Same as specifying <code>-i &lt;num&gt;</code>.</p>
 171 <h4 id="time">TIME</h4>
 172 <p>Amount of time to spend in each measurement iteration, in seconds. Same as specifying <code>-r &lt;num&gt;</code></p>
 173 <h4 id="warmup_iter">WARMUP_ITER</h4>
 174 <p>Number of warmup iterations to run before the measurement phase in each fork. Same as specifying <code>-wi &lt;num&gt;</code>.</p>
 175 <h4 id="warmup_time">WARMUP_TIME</h4>
 176 <p>Amount of time to spend in each warmup iteration. Same as specifying <code>-w &lt;num&gt;</code>.</p>
 177 <h4 id="results_format">RESULTS_FORMAT</h4>
 178 <p>Specify to have the test run save a log of the values. Accepts the same values as <code>-rff</code>, i.e., <code>text</code>, <code>csv</code>, <code>scsv</code>, <code>json</code>, or <code>latex</code>.</p>
 179 <h4 id="vm_options-2">VM_OPTIONS</h4>
 180 <p>Additional VM arguments to provide to forked off VMs. Same as <code>-jvmArgs &lt;args&gt;</code></p>
 181 <h4 id="options-2">OPTIONS</h4>
 182 <p>Additional arguments to send to JMH.</p>










 183 </body>
 184 </html>
< prev index next >