RFR: 8352107: Allow jtreg test cases to query test VM properties

Ioi Lam iklam at openjdk.org
Sun Mar 16 02:59:32 UTC 2025


This PR tries to cut down the use of `WhiteBox` in the HotSpot test cases. It modifies `VMProps` to save the set of VM properties into a file called "vm.properties" under Jtreg's work directory. The new API `jdk.test.lib.VMPropsGetter` loads the properties from this file to pass onto individual test cases.

See `getJtregWorkDir()` for the code that figures out the work directory. It assumes that `VMProps` and all test cases are always executed under

- `workDir/scratch/` ; or
- `workDir/scratch/[0-9]+/` 

This is probably not the right thing to do. I would be better for Jtreg to pass the location of the work directory to the test cases, with a command-line options like `-Djtreg.work.dir=<dir>`.

To show the benefit of this PR, I modified a few test cases to remove their use of WhiteBox.

-------------

Commit messages:
 - 8352107: Allow jtreg test cases to query test VM properties

Changes: https://git.openjdk.org/jdk/pull/24071/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24071&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8352107
  Stats: 202 lines in 7 files changed: 192 ins; 4 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/24071.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24071/head:pull/24071

PR: https://git.openjdk.org/jdk/pull/24071


More information about the core-libs-dev mailing list