Skip to content

Commit aacb827

Browse files
committed
8220639: Need a way to augment JTREG_LAUNCHER_OPTIONS from command-line
Reviewed-by: erikj, dholmes
1 parent 47e465c commit aacb827

File tree

5 files changed

+144
-64
lines changed

5 files changed

+144
-64
lines changed

doc/testing.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ <h4 id="jobs-1">JOBS</h4>
137137
<h4 id="timeout_factor-1">TIMEOUT_FACTOR</h4>
138138
<p>The timeout factor (<code>-timeoutFactor</code>).</p>
139139
<p>Defaults to 4.</p>
140+
<h4 id="failure_handler_timeout">FAILURE_HANDLER_TIMEOUT</h4>
141+
<p>Sets the argument <code>-timeoutHandlerTimeout</code> for JTReg. The default value is 0. This is only valid if the failure handler is built.</p>
140142
<h4 id="test_mode">TEST_MODE</h4>
141143
<p>The test mode (<code>agentvm</code> or <code>othervm</code>).</p>
142144
<p>Defaults to <code>agentvm</code>.</p>
@@ -153,8 +155,10 @@ <h4 id="max_mem">MAX_MEM</h4>
153155
<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
154156
<p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
155157
<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
158+
<h4 id="max_output">MAX_OUTPUT</h4>
159+
<p>Set the property <code>javatest.maxOutputSize</code> for the launcher, to change the default JTReg log limit.</p>
156160
<h4 id="keywords">KEYWORDS</h4>
157-
<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>
161+
<p>JTReg keywords 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>
158162
<h4 id="extra_problem_lists">EXTRA_PROBLEM_LISTS</h4>
159163
<p>Use additional problem lists file or files, in addition to the default ProblemList.txt located at the JTReg test roots.</p>
160164
<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>
@@ -170,6 +174,8 @@ <h4 id="java_options-1">JAVA_OPTIONS</h4>
170174
<h4 id="vm_options-1">VM_OPTIONS</h4>
171175
<p>Additional Java options to be used when compiling and running classes (sent to JTReg as <code>-vmoption</code>).</p>
172176
<p>This option is only needed in special circumstances. To pass Java options to your test classes, use <code>JAVA_OPTIONS</code>.</p>
177+
<h4 id="launcher_options">LAUNCHER_OPTIONS</h4>
178+
<p>Additional Java options that are sent to the java launcher that starts the JTReg harness.</p>
173179
<h4 id="aot_modules-1">AOT_MODULES</h4>
174180
<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>
175181
<h4 id="retry_count">RETRY_COUNT</h4>
@@ -205,14 +211,19 @@ <h3 id="docker-tests">Docker Tests</h3>
205211
<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>
206212
<pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot;</code></pre>
207213
<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>
208-
<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>
214+
<pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot; \
215+
JTREG=&quot;JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
216+
-Djdk.test.docker.image.version=latest&quot;</code></pre>
209217
<h3 id="non-us-locale">Non-US locale</h3>
210-
<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>
218+
<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.</p>
219+
<p>For example:</p>
211220
<pre><code>$ export LANG=&quot;en_US&quot; &amp;&amp; make test TEST=...
212221
$ make test JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot; TEST=...</code></pre>
213222
<h3 id="pkcs11-tests">PKCS11 Tests</h3>
214-
<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories. For example:</p>
215-
<pre><code>$ make test TEST=&quot;jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java&quot; JTREG=&quot;JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs&quot;</code></pre>
223+
<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories.</p>
224+
<p>For example:</p>
225+
<pre><code>$ make test TEST=&quot;jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java&quot; \
226+
JTREG=&quot;JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs&quot;</code></pre>
216227
<p>For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.</p>
217228
<h3 id="client-ui-tests">Client UI Tests</h3>
218229
<p>Some Client UI tests use key sequences which may be reserved by the operating system. Usually that causes the test failure. So it is highly recommended to disable system key shortcuts prior testing. The steps to access and disable system key shortcuts for various platforms are provided below.</p>

doc/testing.md

Lines changed: 107 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ Note that this option should point to the JTReg home, i.e. the top directory,
3737
containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME`
3838
environment variable to point to the JTReg home before running `configure`.)
3939

40-
To be able to run microbenchmarks, `configure` needs to know where to find
41-
the JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
42-
containing the core JMH and transitive dependencies. The recommended dependencies
43-
can be retrieved by running `sh make/devkit/createJMHBundle.sh`, after which
44-
`--with-jmh=build/jmh/jars` should work.
40+
To be able to run microbenchmarks, `configure` needs to know where to find the
41+
JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
42+
containing the core JMH and transitive dependencies. The recommended
43+
dependencies can be retrieved by running `sh make/devkit/createJMHBundle.sh`,
44+
after which `--with-jmh=build/jmh/jars` should work.
4545

4646
## Test selection
4747

@@ -182,10 +182,10 @@ variables.
182182
These variables use a keyword=value approach to allow multiple values to be
183183
set. So, for instance, `JTREG="JOBS=1;TIMEOUT_FACTOR=8"` will set the JTReg
184184
concurrency level to 1 and the timeout factor to 8. This is equivalent to
185-
setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format means that
186-
the `JTREG` variable is parsed and verified for correctness, so
187-
`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8` would just
188-
pass unnoticed.
185+
setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format
186+
means that the `JTREG` variable is parsed and verified for correctness, so
187+
`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8`
188+
would just pass unnoticed.
189189

190190
To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell
191191
normally eats `;`, the recommended usage is to write the assignment inside
@@ -203,9 +203,10 @@ test suites.
203203

204204
### General keywords (TEST_OPTS)
205205

206-
Some keywords are valid across different test suites. If you want to run
207-
tests from multiple test suites, or just don't want to care which test suite specific
208-
control variable to use, then you can use the general TEST_OPTS control variable.
206+
Some keywords are valid across different test suites. If you want to run tests
207+
from multiple test suites, or just don't want to care which test suite specific
208+
control variable to use, then you can use the general TEST_OPTS control
209+
variable.
209210

210211
There are also some keywords that applies globally to the test runner system,
211212
not to any specific test suites. These are also available as TEST_OPTS keywords.
@@ -252,55 +253,72 @@ for only recently changed code. JCOV_DIFF_CHANGESET specifies a source
252253
revision. A textual report will be generated showing coverage of the diff
253254
between the specified revision and the repository tip.
254255

255-
The report is stored in `build/$BUILD/test-results/jcov-output/diff_coverage_report`
256-
file.
256+
The report is stored in
257+
`build/$BUILD/test-results/jcov-output/diff_coverage_report` file.
257258

258259
### JTReg keywords
259260

260261
#### JOBS
262+
261263
The test concurrency (`-concurrency`).
262264

263265
Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to
264266
JOBS, except for Hotspot, where the default is *number of CPU cores/2*,
265267
but never more than *memory size in GB/2*.
266268

267269
#### TIMEOUT_FACTOR
270+
268271
The timeout factor (`-timeoutFactor`).
269272

270273
Defaults to 4.
271274

275+
#### FAILURE_HANDLER_TIMEOUT
276+
277+
Sets the argument `-timeoutHandlerTimeout` for JTReg. The default value is 0.
278+
This is only valid if the failure handler is built.
279+
272280
#### TEST_MODE
281+
273282
The test mode (`agentvm` or `othervm`).
274283

275284
Defaults to `agentvm`.
276285

277286
#### ASSERT
287+
278288
Enable asserts (`-ea -esa`, or none).
279289

280290
Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except
281291
for hotspot.
282292

283293
#### VERBOSE
294+
284295
The verbosity level (`-verbose`).
285296

286297
Defaults to `fail,error,summary`.
287298

288299
#### RETAIN
300+
289301
What test data to retain (`-retain`).
290302

291303
Defaults to `fail,error`.
292304

293305
#### MAX_MEM
306+
294307
Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none).
295308

296309
Limit memory consumption for JTReg test framework and VM under test. Set to 0
297310
to disable the limits.
298311

299312
Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
300313

314+
#### MAX_OUTPUT
315+
316+
Set the property `javatest.maxOutputSize` for the launcher, to change the
317+
default JTReg log limit.
318+
301319
#### KEYWORDS
302320

303-
JTReg kewords sent to JTReg using `-k`. Please be careful in making sure that
321+
JTReg keywords sent to JTReg using `-k`. Please be careful in making sure that
304322
spaces and special characters (like `!`) are properly quoted. To avoid some
305323
issues, the special value `%20` can be used instead of space.
306324

@@ -323,23 +341,30 @@ Set to `true` or `false`.
323341
If `true`, JTReg will use `-match:` option, otherwise `-exclude:` will be used.
324342
Default is `false`.
325343

326-
327344
#### OPTIONS
345+
328346
Additional options to the JTReg test framework.
329347

330348
Use `JTREG="OPTIONS=--help all"` to see all available JTReg options.
331349

332350
#### JAVA_OPTIONS
351+
333352
Additional Java options for running test classes (sent to JTReg as
334353
`-javaoption`).
335354

336355
#### VM_OPTIONS
356+
337357
Additional Java options to be used when compiling and running classes (sent to
338358
JTReg as `-vmoption`).
339359

340360
This option is only needed in special circumstances. To pass Java options to
341361
your test classes, use `JAVA_OPTIONS`.
342362

363+
#### LAUNCHER_OPTIONS
364+
365+
Additional Java options that are sent to the java launcher that starts the
366+
JTReg harness.
367+
343368
#### AOT_MODULES
344369

345370
Generate AOT modules before testing for the specified module, or set of
@@ -353,13 +378,15 @@ Retry failed tests up to a set number of times. Defaults to 0.
353378
### Gtest keywords
354379

355380
#### REPEAT
381+
356382
The number of times to repeat the tests (`--gtest_repeat`).
357383

358384
Default is 1. Set to -1 to repeat indefinitely. This can be especially useful
359385
combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent
360386
problem.
361387

362388
#### OPTIONS
389+
363390
Additional options to the Gtest test framework.
364391

365392
Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
@@ -373,98 +400,127 @@ modules. If multiple modules are specified, they should be separated by space
373400
### Microbenchmark keywords
374401

375402
#### FORK
403+
376404
Override the number of benchmark forks to spawn. Same as specifying `-f <num>`.
377405

378406
#### ITER
407+
379408
Number of measurement iterations per fork. Same as specifying `-i <num>`.
380409

381410
#### TIME
411+
382412
Amount of time to spend in each measurement iteration, in seconds. Same as
383413
specifying `-r <num>`
384414

385415
#### WARMUP_ITER
416+
386417
Number of warmup iterations to run before the measurement phase in each fork.
387418
Same as specifying `-wi <num>`.
388419

389420
#### WARMUP_TIME
421+
390422
Amount of time to spend in each warmup iteration. Same as specifying `-w <num>`.
391423

392424
#### RESULTS_FORMAT
425+
393426
Specify to have the test run save a log of the values. Accepts the same values
394427
as `-rff`, i.e., `text`, `csv`, `scsv`, `json`, or `latex`.
395428

396429
#### VM_OPTIONS
430+
397431
Additional VM arguments to provide to forked off VMs. Same as `-jvmArgs <args>`
398432

399433
#### OPTIONS
434+
400435
Additional arguments to send to JMH.
401436

402437
## Notes for Specific Tests
403438

404439
### Docker Tests
405440

406-
Docker tests with default parameters may fail on systems with glibc versions not
407-
compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86).
408-
For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:
441+
Docker tests with default parameters may fail on systems with glibc versions
442+
not compatible with the one used in the default docker image (e.g., Oracle
443+
Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu
444+
18.04 if run like this on x86:
409445

410-
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
446+
```
447+
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
448+
```
411449

412-
To run these tests correctly, additional parameters for the correct docker image are
413-
required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
450+
To run these tests correctly, additional parameters for the correct docker
451+
image are required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
414452

415-
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"
453+
```
454+
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" \
455+
JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
456+
-Djdk.test.docker.image.version=latest"
457+
```
416458

417459
### Non-US locale
418460

419-
If your locale is non-US, some tests are likely to fail. To work around this you can
420-
set the locale to US. On Unix platforms simply setting `LANG="en_US"` in the
421-
environment before running tests should work. On Windows, setting
422-
`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but not all test cases.
461+
If your locale is non-US, some tests are likely to fail. To work around this
462+
you can set the locale to US. On Unix platforms simply setting `LANG="en_US"`
463+
in the environment before running tests should work. On Windows, setting
464+
`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but
465+
not all test cases.
466+
423467
For example:
424468

425-
$ export LANG="en_US" && make test TEST=...
426-
$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
469+
```
470+
$ export LANG="en_US" && make test TEST=...
471+
$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
472+
```
427473

428474
### PKCS11 Tests
429475

430-
It is highly recommended to use the latest NSS version when running PKCS11 tests.
431-
Improper NSS version may lead to unexpected failures which are hard to diagnose.
432-
For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu
433-
18.04 with the default NSS version in the system.
434-
To run these tests correctly, the system property `test.nss.lib.paths` is required
435-
on Ubuntu 18.04 to specify the alternative NSS lib directories.
476+
It is highly recommended to use the latest NSS version when running PKCS11
477+
tests. Improper NSS version may lead to unexpected failures which are hard to
478+
diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail
479+
on Ubuntu 18.04 with the default NSS version in the system. To run these tests
480+
correctly, the system property `test.nss.lib.paths` is required on Ubuntu 18.04
481+
to specify the alternative NSS lib directories.
482+
436483
For example:
437484

438-
$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
485+
```
486+
$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" \
487+
JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
488+
```
439489

440-
For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.
490+
For more notes about the PKCS11 tests, please refer to
491+
test/jdk/sun/security/pkcs11/README.
441492

442493
### Client UI Tests
443494

444495
Some Client UI tests use key sequences which may be reserved by the operating
445-
system. Usually that causes the test failure. So it is highly recommended to disable
446-
system key shortcuts prior testing. The steps to access and disable system key shortcuts
447-
for various platforms are provided below.
496+
system. Usually that causes the test failure. So it is highly recommended to
497+
disable system key shortcuts prior testing. The steps to access and disable
498+
system key shortcuts for various platforms are provided below.
448499

449500
#### MacOS
501+
450502
Choose Apple menu; System Preferences, click Keyboard, then click Shortcuts;
451503
select or deselect desired shortcut.
452504

453-
For example, test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java fails
454-
on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip message
455-
but the key combination is reserved by the operating system. To run the test correctly
456-
the default global key shortcut should be disabled using the steps described above, and then deselect
457-
"Turn keyboard access on or off" option which is responsible for `CTRL + F1` combination.
505+
For example,
506+
test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java
507+
fails on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip
508+
message but the key combination is reserved by the operating system. To run the
509+
test correctly the default global key shortcut should be disabled using the
510+
steps described above, and then deselect "Turn keyboard access on or off"
511+
option which is responsible for `CTRL + F1` combination.
458512

459513
#### Linux
460-
Open the Activities overview and start typing Settings; Choose Settings, click Devices,
461-
then click Keyboard; set or override desired shortcut.
514+
515+
Open the Activities overview and start typing Settings; Choose Settings, click
516+
Devices, then click Keyboard; set or override desired shortcut.
462517

463518
#### Windows
464-
Type `gpedit` in the Search and then click Edit group policy; navigate to
465-
User Configuration -> Administrative Templates -> Windows Components -> File Explorer;
466-
in the right-side pane look for "Turn off Windows key hotkeys" and double click on it;
467-
enable or disable hotkeys.
519+
520+
Type `gpedit` in the Search and then click Edit group policy; navigate to User
521+
Configuration -> Administrative Templates -> Windows Components -> File
522+
Explorer; in the right-side pane look for "Turn off Windows key hotkeys" and
523+
double click on it; enable or disable hotkeys.
468524

469525
Note: restart is required to make the settings take effect.
470526

0 commit comments

Comments
 (0)