[Question] The property `vm.gc` in jtreg test
Chen Liang
chen.l.liang at oracle.com
Sat Aug 30 13:43:34 UTC 2025
Hello, I don't think this is as harmful as you have assumed.
The way CDS tests work (taking runtime/cds/appcds/aotCache/HelloAOTCache.java for example) is that the tests themselves are just drivers to execute jar applications (because CDS only works for jar applications). test.cds.runtime.options system property is only provided when running customized runtime/cds tests so flags can be passed to child vms, and all those tests anticipate vm.gc to indicate the gc for the child vm spawned by the driver.
In conclusion, I don't think a rename would be necessary, as I don't see a scenario where the driver itself would care about its own gc in addition to the child process gc.
CC'ing Ioi as Ioi is the main CDS area maintainer.
Chen
________________________________
From: hotspot-dev <hotspot-dev-retn at openjdk.org> on behalf of Guoxiong Li <lgxbslgx at gmail.com>
Sent: Saturday, August 30, 2025 5:40 AM
To: hotspot-gc-dev at openjdk.org <hotspot-gc-dev at openjdk.org>; hotspot-runtime-dev at openjdk.org <hotspot-runtime-dev at openjdk.org>; hotspot-dev at openjdk.org <hotspot-dev at openjdk.org>
Subject: [Question] The property `vm.gc` in jtreg test
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/413dd8c9/attachment.htm>
More information about the hotspot-dev
mailing list