From 335320ed851d3c4ff3da4971c0fbf0c6d70613f4 Mon Sep 17 00:00:00 2001 From: "jingduanyang.0" Date: Wed, 20 May 2026 15:25:04 +0800 Subject: [PATCH 1/2] cvm/overlay: (1/2) Fix gc/startup_warnings tests Add the original JDK 8 gc/startup_warnings test file to cvm/overlay/jdk8u as the baseline for the follow-up overlay changes. This keeps the compatibility adjustments isolated in the second commit while preserving the unmodified upstream test source in the overlay history. --- .../TestDefaultMaxRAMFraction.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java diff --git a/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java b/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java new file mode 100644 index 00000000000..059a526acf4 --- /dev/null +++ b/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +*/ + +/* +* @test TestDefaultMaxRAMFraction +* @key gc +* @bug 8021967 +* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message +* @library /testlibrary +*/ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.ProcessTools; + +public class TestDefaultMaxRAMFraction { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead."); + output.shouldNotContain("error"); + output.shouldHaveExitValue(0); + } + +} From 17f08d69e6e5779f256b2726b13c2318e90bc69a Mon Sep 17 00:00:00 2001 From: "jingduanyang.0" Date: Wed, 20 May 2026 15:25:45 +0800 Subject: [PATCH 2/2] cvm/overlay: (2/2) Fix gc/startup_warnings tests Adjust the TestDefaultMaxRAMFraction.java startup warning test to match the JDK17 hotspot behavior while keeping the changes isolated under the JDK 8 overlay. - TestDefaultMaxRAMFraction.java: JDK 17 still warns for DefaultMaxRAMFraction, but the warning is emitted by the JDK17 hotspot deprecation path with different wording; update the expected text to the JDK17 hotspot message. --- cvm.mk | 1 + cvm/conf/jtreg_hotspot8_excludes_aarch64.list | 1 - cvm/conf/jtreg_hotspot8_excludes_x64.list | 1 - .../test/gc/startup_warnings/TestDefaultMaxRAMFraction.java | 2 +- 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cvm.mk b/cvm.mk index 70c2a0210a4..96ef11378ff 100644 --- a/cvm.mk +++ b/cvm.mk @@ -448,6 +448,7 @@ endif $(call overlay_single,jdk8u,hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java, $(JDK8_SRCROOT)) $(call overlay_single,jdk8u,hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java, $(JDK8_SRCROOT)) $(call overlay_single,jdk8u,hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java, $(JDK8_SRCROOT)) + $(call overlay_single,jdk8u,hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java, $(JDK8_SRCROOT)) -overlay-jtreg: $(call overlay_single,jdk8u,test/jtreg-ext/requires/VMProps.java, $(JDK8_SRCROOT)) diff --git a/cvm/conf/jtreg_hotspot8_excludes_aarch64.list b/cvm/conf/jtreg_hotspot8_excludes_aarch64.list index b65f81916f8..991165091ce 100644 --- a/cvm/conf/jtreg_hotspot8_excludes_aarch64.list +++ b/cvm/conf/jtreg_hotspot8_excludes_aarch64.list @@ -45,7 +45,6 @@ gc/metaspace/TestMetaspaceSizeFlags.java gc/parallelScavenge/AdaptiveGCBoundary.java gc/startup_warnings/TestCMSForegroundFlags.java gc/startup_warnings/TestCMSIncrementalMode.java -gc/startup_warnings/TestDefaultMaxRAMFraction.java gc/startup_warnings/TestDefNewCMS.java gc/startup_warnings/TestIncGC.java gc/6581734/Test6581734.java diff --git a/cvm/conf/jtreg_hotspot8_excludes_x64.list b/cvm/conf/jtreg_hotspot8_excludes_x64.list index a987b3cdc89..6a94de778e1 100644 --- a/cvm/conf/jtreg_hotspot8_excludes_x64.list +++ b/cvm/conf/jtreg_hotspot8_excludes_x64.list @@ -39,7 +39,6 @@ gc/metaspace/TestMetaspaceSizeFlags.java gc/parallelScavenge/AdaptiveGCBoundary.java gc/startup_warnings/TestCMSForegroundFlags.java gc/startup_warnings/TestCMSIncrementalMode.java -gc/startup_warnings/TestDefaultMaxRAMFraction.java gc/startup_warnings/TestDefNewCMS.java gc/startup_warnings/TestIncGC.java gc/6581734/Test6581734.java diff --git a/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java b/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java index 059a526acf4..f8af69d3d85 100644 --- a/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java +++ b/cvm/overlay/jdk8u/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java @@ -36,7 +36,7 @@ public class TestDefaultMaxRAMFraction { public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead."); + output.shouldContain("warning: Option DefaultMaxRAMFraction was deprecated in version 8.0 and will likely be removed in a future release. Use option MaxRAMFraction instead."); output.shouldNotContain("error"); output.shouldHaveExitValue(0); }