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

Ioi Lam iklam at openjdk.org
Mon Mar 17 08:48:56 UTC 2025


On Mon, 17 Mar 2025 07:55:00 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> > This is probably not the right thing to do.
> 
> I agree that this doesn't sound like the right thing to do. This breaks the jtreg -othervm mode.
> 
> I use the -othervm mode whenever I want to run reproduce a failure in jtreg. In -othervm mode the pwd is the same as the final destination of the log files, hs_err files, jars, etc. So, when the logs says "hs_err files is written to xyz" it actually is left in that directory. In -agentvm mode the JVM says that the hs_err files is in scratch/<0>, but you won't find a hs_err file there, because jtreg moved it. Even more annoying is that in -agentvm mode it moves the whitebox.jar file, so the printed "rerun" line is not usable. If you run in -othervm mode you can copy and past the rerun line and it actually works, even when you are using the whitebox APIs.
> 
> Is there a way to get this patch to also work in -othervm mode?
> 
> When I run the test above with -othervm -retain -concurrency:1 I get the log files here:
> 
> ```
> jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotClassLinking_BulkLoaderTest_java/runtime/cds/appcds/aotClassLinking/BulkLoaderTest_aot
> ```
> 
> but the vm.properties file is located here:
> 
> ```
> jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotClassLinking_BulkLoaderTest_java/vm.properties
> ```
> 
> So, I'm not sure what's the easiest way to fix that. Maybe walk the chain of parent directories until you find the vm.properties file?

Actually my PR may not cover all VM properties. VMProps is just for computing the "extra" properties:


requires.extraPropDefns = ../jtreg-ext/requires/VMProps.java


But jtreg also computes "built-in" properties like `jdk.version.major`, `os.simpleArch`, etc:

https://openjdk.org/jtreg/tag-spec.html#requires_names

So I think the best solution may be for jtreg to save the properties to a location of its choice, and pass this location to the test cases with a property like `test.vm.properties.file`.

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

PR Comment: https://git.openjdk.org/jdk/pull/24071#issuecomment-2728610838


More information about the core-libs-dev mailing list