doc/testing.html
branchJEP-230-microbenchmarks-branch
changeset 56980 26e61f9ceec4
parent 51644 0df09dadd445
equal deleted inserted replaced
56979:f62a71a762af 56980:26e61f9ceec4
    22 <li><a href="#configuration">Configuration</a></li>
    22 <li><a href="#configuration">Configuration</a></li>
    23 </ul></li>
    23 </ul></li>
    24 <li><a href="#test-selection">Test selection</a><ul>
    24 <li><a href="#test-selection">Test selection</a><ul>
    25 <li><a href="#jtreg">JTReg</a></li>
    25 <li><a href="#jtreg">JTReg</a></li>
    26 <li><a href="#gtest">Gtest</a></li>
    26 <li><a href="#gtest">Gtest</a></li>
       
    27 <li><a href="#microbenchmarks">Microbenchmarks</a></li>
    27 </ul></li>
    28 </ul></li>
    28 <li><a href="#test-results-and-summary">Test results and summary</a></li>
    29 <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>
    30 <li><a href="#test-suite-control">Test suite control</a><ul>
    30 <li><a href="#jtreg-keywords">JTReg keywords</a></li>
    31 <li><a href="#jtreg-keywords">JTReg keywords</a></li>
    31 <li><a href="#gtest-keywords">Gtest keywords</a></li>
    32 <li><a href="#gtest-keywords">Gtest keywords</a></li>
       
    33 <li><a href="#microbenchmark-keywords">Microbenchmark keywords</a></li>
    32 </ul></li>
    34 </ul></li>
    33 </ul>
    35 </ul>
    34 </nav>
    36 </nav>
    35 <h2 id="using-the-run-test-framework">Using the run-test framework</h2>
    37 <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>
    38 <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>
    40 $ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
    42 $ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
    41 $ make run-test TEST=jdk_lang
    43 $ make run-test TEST=jdk_lang
    42 $ make run-test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
    44 $ make run-test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
    43 $ make run-test TEST=&quot;hotspot:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
    45 $ make run-test TEST=&quot;hotspot:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
    44 $ make run-test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
    46 $ make run-test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
       
    47 $ make run-test TEST=&quot;micro:java.lang.reflect&quot; MICRO=&quot;FORK=1;WARMUP_ITER=2&quot;
    45 $ make exploded-run-test TEST=tier2</code></pre>
    48 $ make exploded-run-test TEST=tier2</code></pre>
    46 <h3 id="configuration">Configuration</h3>
    49 <h3 id="configuration">Configuration</h3>
    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=&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>
    50 <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>
       
    51 <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>
    48 <h2 id="test-selection">Test selection</h2>
    52 <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>
    53 <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>
    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=&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>
    54 <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>
    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:$(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</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>
    55 <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:$(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</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>
    52 <h3 id="jtreg">JTReg</h3>
    56 <h3 id="jtreg">JTReg</h3>
    57 <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:test/hotspot/jtreg/native_sanity</code>.</p>
    61 <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:test/hotspot/jtreg/native_sanity</code>.</p>
    58 <h3 id="gtest">Gtest</h3>
    62 <h3 id="gtest">Gtest</h3>
    59 <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>
    63 <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>
    60 <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>
    64 <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>
    61 <p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/&lt;variant&gt;</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>
    65 <p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/&lt;variant&gt;</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>
       
    66 <h3 id="microbenchmarks">Microbenchmarks</h3>
       
    67 <p>Which microbenchmarks to run is selected using a regular expression following the <code>micro:</code> test descriptor, e.g., <code>micro:java.lang.reflect</code>. This delegates the test selection to JMH, meaning package name, class name and even benchmark method names can be used to select tests.</p>
       
    68 <p>Using special characters like <code>|</code> in the regular expression is possible, but needs to be escaped multiple times: <code>micro:ArrayCopy\\\\\|reflect</code>.</p>
    62 <h2 id="test-results-and-summary">Test results and summary</h2>
    69 <h2 id="test-results-and-summary">Test results and summary</h2>
    63 <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>
    70 <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>
    64 <pre><code>==============================
    71 <pre><code>==============================
    65 Test summary
    72 Test summary
    66 ==============================
    73 ==============================
   116 <p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
   123 <p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
   117 <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>
   124 <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>
   118 <h4 id="options-1">OPTIONS</h4>
   125 <h4 id="options-1">OPTIONS</h4>
   119 <p>Additional options to the Gtest test framework.</p>
   126 <p>Additional options to the Gtest test framework.</p>
   120 <p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
   127 <p>Use <code>GTEST=&quot;OPTIONS=--help&quot;</code> to see all available Gtest options.</p>
       
   128 <h3 id="microbenchmark-keywords">Microbenchmark keywords</h3>
       
   129 <h4 id="fork">FORK</h4>
       
   130 <p>Override the number of benchmark forks to spawn. Same as specifying <code>-f &lt;num&gt;</code>.</p>
       
   131 <h4 id="iter">ITER</h4>
       
   132 <p>Number of measurement iterations per fork. Same as specifying <code>-i &lt;num&gt;</code>.</p>
       
   133 <h4 id="time">TIME</h4>
       
   134 <p>Amount of time to spend in each measurement iteration, in seconds. Same as specifying <code>-r &lt;num&gt;</code></p>
       
   135 <h4 id="warmup_iter">WARMUP_ITER</h4>
       
   136 <p>Number of warmup iterations to run before the measurement phase in each fork. Same as specifying <code>-wi &lt;num&gt;</code>.</p>
       
   137 <h4 id="warmup_time">WARMUP_TIME</h4>
       
   138 <p>Amount of time to spend in each warmup iteration. Same as specifying <code>-w &lt;num&gt;</code>.</p>
       
   139 <h4 id="results_format">RESULTS_FORMAT</h4>
       
   140 <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>
       
   141 <h4 id="vm_options-1">VM_OPTIONS</h4>
       
   142 <p>Additional VM arguments to provide to forked off VMs. Same as <code>-jvmArgs &lt;args&gt;</code></p>
       
   143 <h4 id="options-2">OPTIONS</h4>
       
   144 <p>Additional arguments to send to JMH.</p>
   121 </body>
   145 </body>
   122 </html>
   146 </html>