Skip to content

Commit 1595b14

Browse files
committed
Merge
2 parents 5146ebc + 17e3412 commit 1595b14

File tree

437 files changed

+7550
-6334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

437 files changed

+7550
-6334
lines changed

doc/testing.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ <h1 class="title">Testing the JDK</h1>
2323
</header>
2424
<nav id="TOC">
2525
<ul>
26-
<li><a href="#using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</a><ul>
26+
<li><a href="#overview">Overview</a></li>
27+
<li><a href="#running-tests-locally-with-make-test">Running tests locally with <code>make test</code></a><ul>
2728
<li><a href="#configuration">Configuration</a></li>
2829
</ul></li>
2930
<li><a href="#test-selection">Test selection</a><ul>
@@ -49,10 +50,12 @@ <h1 class="title">Testing the JDK</h1>
4950
<li><a href="#editing-this-document">Editing this document</a></li>
5051
</ul>
5152
</nav>
52-
<h2 id="using-make-test-the-run-test-framework">Using &quot;make test&quot; (the run-test framework)</h2>
53-
<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>
54-
<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>
55-
<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>
53+
<h2 id="overview">Overview</h2>
54+
<p>The bulk of JDK tests use <a href="https://openjdk.org/jtreg/">jtreg</a>, a regression test framework and test runner built for the JDK's specific needs. Other test frameworks are also used. The different test frameworks can be executed directly, but there is also a set of make targets intended to simplify the interface, and figure out how to run your tests for you.</p>
55+
<h2 id="running-tests-locally-with-make-test">Running tests locally with <code>make test</code></h2>
56+
<p>This is the easiest way to get started. Assuming you've built the JDK locally, execute:</p>
57+
<pre><code>$ make test</code></pre>
58+
<p>This will run a default set of tests against the JDK, and present you with the results. <code>make test</code> is part of a family of test-related make targets which simplify running tests, because they invoke the various test frameworks for you. The &quot;make test framework&quot; is simple to start with, but more complex ad-hoc combination of tests is also possible. You can always invoke the test frameworks directly if you want even more control.</p>
5659
<p>Some example command-lines:</p>
5760
<pre><code>$ make test-tier1
5861
$ make test-jdk_lang JTREG=&quot;JOBS=8&quot;
@@ -62,6 +65,8 @@ <h2 id="using-make-test-the-run-test-framework">Using &quot;make test&quot; (the
6265
$ make test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
6366
$ make test TEST=&quot;micro:java.lang.reflect&quot; MICRO=&quot;FORK=1;WARMUP_ITER=2&quot;
6467
$ make exploded-test TEST=tier2</code></pre>
68+
<p>&quot;tier1&quot; and &quot;tier2&quot; refer to tiered testing, see further down. &quot;TEST&quot; is a test selection argument which the make test framework will use to try to find the tests you want. It iterates over the available test frameworks, and if the test isn't present in one, it tries the next one. 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>
69+
<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>
6570
<h3 id="configuration">Configuration</h3>
6671
<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>
6772
<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>
@@ -81,8 +86,8 @@ <h3 id="common-test-groups">Common Test Groups</h3>
8186
<p>A brief description of the tiered test groups:</p>
8287
<ul>
8388
<li><p><code>tier1</code>: This is the lowest test tier. Multiple developers run these tests every day. Because of the widespread use, the tests in <code>tier1</code> are carefully selected and optimized to run fast, and to run in the most stable manner. The test failures in <code>tier1</code> are usually followed up on quickly, either with fixes, or adding relevant tests to problem list. GitHub Actions workflows, if enabled, run <code>tier1</code> tests.</p></li>
84-
<li><p><code>tier2</code>: This test group covers even more ground. These contain, among other things, tests that either run for too long to be at <code>tier1</code>, or may require special configuration, or tests that are less stable, or cover the broader range of non-core JVM and JDK features/components (for example, XML).</p></li>
85-
<li><p><code>tier3</code>: This test group includes more stressful tests, the tests for corner cases not covered by previous tiers, plus the tests that require GUIs. As such, this suite should either be run with low concurrency (<code>TEST_JOBS=1</code>), or without headful tests (<code>JTREG_KEYWORDS=\!headful</code>), or both.</p></li>
89+
<li><p><code>tier2</code>: This test group covers even more ground. These contain, among other things, tests that either run for too long to be at <code>tier1</code>, or may require special configuration, or tests that are less stable, or cover the broader range of non-core JVM and JDK features/components(for example, XML).</p></li>
90+
<li><p><code>tier3</code>: This test group includes more stressful tests, the tests for corner cases not covered by previous tiers, plus the tests that require GUIs. As such, this suite should either be run with low concurrency (<code>TEST_JOBS=1</code>), or without headful tests(<code>JTREG_KEYWORDS=\!headful</code>), or both.</p></li>
8691
<li><p><code>tier4</code>: This test group includes every other test not covered by previous tiers. It includes, for example, <code>vmTestbase</code> suites for Hotspot, which run for many hours even on large machines. It also runs GUI tests, so the same <code>TEST_JOBS</code> and <code>JTREG_KEYWORDS</code> caveats apply.</p></li>
8792
</ul>
8893
<h3 id="jtreg">JTReg</h3>

doc/testing.md

Lines changed: 72 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
% Testing the JDK
22

3-
## Using "make test" (the run-test framework)
3+
## Overview
44

5-
This new way of running tests is developer-centric. It assumes that you have
6-
built a JDK locally and want to test it. Running common test targets is simple,
7-
and more complex ad-hoc combination of tests is possible. The user interface is
8-
forgiving, and clearly report errors it cannot resolve.
5+
The bulk of JDK tests use [jtreg](https://openjdk.org/jtreg/), a regression
6+
test framework and test runner built for the JDK's specific needs. Other test
7+
frameworks are also used. The different test frameworks can be executed
8+
directly, but there is also a set of make targets intended to simplify the
9+
interface, and figure out how to run your tests for you.
910

10-
The main target `test` uses the jdk-image as the tested product. There is
11-
also an alternate target `exploded-test` that uses the exploded image
12-
instead. Not all tests will run successfully on the exploded image, but using
13-
this target can greatly improve rebuild times for certain workflows.
11+
## Running tests locally with `make test`
1412

15-
Previously, `make test` was used to invoke an old system for running tests, and
16-
`make run-test` was used for the new test framework. For backward compatibility
17-
with scripts and muscle memory, `run-test` (and variants like
18-
`exploded-run-test` or `run-test-tier1`) are kept as aliases.
13+
This is the easiest way to get started. Assuming you've built the JDK locally,
14+
execute:
15+
16+
$ make test
17+
18+
This will run a default set of tests against the JDK, and present you with the
19+
results. `make test` is part of a family of test-related make targets which
20+
simplify running tests, because they invoke the various test frameworks for
21+
you. The "make test framework" is simple to start with, but more complex
22+
ad-hoc combination of tests is also possible. You can always invoke the test
23+
frameworks directly if you want even more control.
1924

2025
Some example command-lines:
2126

@@ -28,6 +33,20 @@ Some example command-lines:
2833
$ make test TEST="micro:java.lang.reflect" MICRO="FORK=1;WARMUP_ITER=2"
2934
$ make exploded-test TEST=tier2
3035

36+
"tier1" and "tier2" refer to tiered testing, see further down. "TEST" is a
37+
test selection argument which the make test framework will use to try to
38+
find the tests you want. It iterates over the available test frameworks, and
39+
if the test isn't present in one, it tries the next one. The main target
40+
`test` uses the jdk-image as the tested product. There is also an alternate
41+
target `exploded-test` that uses the exploded image instead. Not all tests
42+
will run successfully on the exploded image, but using this target can
43+
greatly improve rebuild times for certain workflows.
44+
45+
Previously, `make test` was used to invoke an old system for running tests,
46+
and `make run-test` was used for the new test framework. For backward
47+
compatibility with scripts and muscle memory, `run-test` and variants like
48+
`exploded-run-test` or `run-test-tier1` are kept as aliases.
49+
3150
### Configuration
3251

3352
To be able to run JTReg tests, `configure` needs to know where to find the
@@ -91,49 +110,53 @@ if you want to shortcut the parser.
91110

92111
### Common Test Groups
93112

94-
Ideally, all tests are run for every change but this may not be practical due to the limited
95-
testing resources, the scope of the change, etc.
113+
Ideally, all tests are run for every change but this may not be practical due
114+
to the limited testing resources, the scope of the change, etc.
96115

97-
The source tree currently defines a few common test groups in the relevant `TEST.groups`
98-
files. There are test groups that cover a specific component, for example `hotspot_gc`.
99-
It is a good idea to look into `TEST.groups` files to get a sense what tests are relevant
100-
to a particular JDK component.
116+
The source tree currently defines a few common test groups in the relevant
117+
`TEST.groups` files. There are test groups that cover a specific component,
118+
for example `hotspot_gc`. It is a good idea to look into `TEST.groups` files
119+
to get a sense what tests are relevant to a particular JDK component.
101120

102-
Component-specific tests may miss some unintended consequences of a change, so other
103-
tests should also be run. Again, it might be impractical to run all tests, and therefore
104-
_tiered_ test groups exist. Tiered test groups are not component-specific, but rather cover
105-
the significant parts of the entire JDK.
121+
Component-specific tests may miss some unintended consequences of a change, so
122+
other tests should also be run. Again, it might be impractical to run all
123+
tests, and therefore
124+
_tiered_ test groups exist. Tiered test groups are not component-specific, but
125+
rather cover the significant parts of the entire JDK.
106126

107-
Multiple tiers allow balancing test coverage and testing costs. Lower test tiers are supposed to
108-
contain the simpler, quicker and more stable tests. Higher tiers are supposed to contain
109-
progressively more thorough, slower, and sometimes less stable tests, or the tests that require
110-
special configuration.
127+
Multiple tiers allow balancing test coverage and testing costs. Lower test
128+
tiers are supposed to contain the simpler, quicker and more stable tests.
129+
Higher tiers are supposed to contain progressively more thorough, slower, and
130+
sometimes less stable tests, or the tests that require special
131+
configuration.
111132

112-
Contributors are expected to run the tests for the areas that are changed, and the first N tiers
113-
they can afford to run, but at least tier1.
133+
Contributors are expected to run the tests for the areas that are changed, and
134+
the first N tiers they can afford to run, but at least tier1.
114135

115136
A brief description of the tiered test groups:
116137

117-
- `tier1`: This is the lowest test tier. Multiple developers run these tests every day.
118-
Because of the widespread use, the tests in `tier1` are carefully selected and optimized to run
119-
fast, and to run in the most stable manner. The test failures in `tier1` are usually followed up
120-
on quickly, either with fixes, or adding relevant tests to problem list. GitHub Actions workflows,
121-
if enabled, run `tier1` tests.
122-
123-
- `tier2`: This test group covers even more ground. These contain, among other things,
124-
tests that either run for too long to be at `tier1`, or may require special configuration,
125-
or tests that are less stable, or cover the broader range of non-core JVM and JDK features/components
126-
(for example, XML).
127-
128-
- `tier3`: This test group includes more stressful tests, the tests for corner cases
129-
not covered by previous tiers, plus the tests that require GUIs. As such, this suite
130-
should either be run with low concurrency (`TEST_JOBS=1`), or without headful tests
131-
(`JTREG_KEYWORDS=\!headful`), or both.
132-
133-
- `tier4`: This test group includes every other test not covered by previous tiers. It includes,
134-
for example, `vmTestbase` suites for Hotspot, which run for many hours even on large
135-
machines. It also runs GUI tests, so the same `TEST_JOBS` and `JTREG_KEYWORDS` caveats
136-
apply.
138+
- `tier1`: This is the lowest test tier. Multiple developers run these tests
139+
every day. Because of the widespread use, the tests in `tier1` are
140+
carefully selected and optimized to run fast, and to run in the most stable
141+
manner. The test failures in `tier1` are usually followed up on quickly,
142+
either with fixes, or adding relevant tests to problem list. GitHub Actions
143+
workflows, if enabled, run `tier1` tests.
144+
145+
- `tier2`: This test group covers even more ground. These contain, among other
146+
things, tests that either run for too long to be at `tier1`, or may require
147+
special configuration, or tests that are less stable, or cover the broader
148+
range of non-core JVM and JDK features/components(for example, XML).
149+
150+
- `tier3`: This test group includes more stressful tests, the tests for corner
151+
cases not covered by previous tiers, plus the tests that require GUIs. As
152+
such, this suite should either be run with low concurrency
153+
(`TEST_JOBS=1`), or without headful tests(`JTREG_KEYWORDS=\!headful`), or
154+
both.
155+
156+
- `tier4`: This test group includes every other test not covered by previous
157+
tiers. It includes, for example, `vmTestbase` suites for Hotspot, which run
158+
for many hours even on large machines. It also runs GUI tests, so the same
159+
`TEST_JOBS` and `JTREG_KEYWORDS` caveats apply.
137160

138161
### JTReg
139162

0 commit comments

Comments
 (0)