[Question] The property `vm.gc` in jtreg test

Guoxiong Li lgxbslgx at gmail.com
Sat Aug 30 10:40:39 UTC 2025


Hi all,

I notice the meaning of the test property `vm.gc` is not clear.
The method `VMProps::vmGCforCDS` (shown below, in directory:
test/jtreg-ext/requires/VMProps.java)
extracts the property `vm.gc` from the option `test.cds.runtime.options`.
So the current `vm.gc` is about both CDS and GC, not only the GC.
I propose changing the current test property name `vm.gc` to `vm.gc.cds` or
`vm.cds.gc`.

Waiting for your opinion. Any ideas will be appreciated.

```java
    /**
     * "jtreg -vmoptions:-Dtest.cds.runtime.options=..." can be used to
specify
     * the GC type to be used when running with a CDS archive. Set "vm.gc"
accordingly,
     * so that tests that need to explicitly choose the GC type can be
excluded
     * with "@requires vm.gc == null".
     *
     * @param map - property-value pairs
     */
    protected void vmGCforCDS(SafeMap map) {
        if (!GC.isSelectedErgonomically()) {
            // The GC has been explicitly specified on the command line, so
            // jtreg will set the "vm.gc" property. Let's not interfere
with it.
            return;
        }

        String jtropts = System.getProperty("test.cds.runtime.options");
        if (jtropts != null) {
            for (String opt : jtropts.split(",")) {
                if (opt.startsWith(GC_PREFIX) && opt.endsWith(GC_SUFFIX)) {
                    String gc = opt.substring(GC_PREFIX.length(),
opt.length() - GC_SUFFIX.length());
                    map.put("vm.gc", () -> gc);
                }
            }
        }
    }
```

Best Regards,
-- Guoxiong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20250830/76668247/attachment-0001.htm>


More information about the hotspot-dev mailing list