cvm/overlay: Fix gc/g1 StringDedup tests#140
Conversation
Adapt gc/g1 StringDeduplication tests for JDK17 hotspot, using the original JDK 8 implementation as baseline. TestStringDeduplicationTools.java: - Replace JDK 8 legacy GC log flags (PrintGCDetails, PrintStringDeduplicationStatistics) with JDK 17 Unified Logging (-Xlog:gc*,stringdedup*) - Update GC output assertions to match the JDK 17 Unified Logging format - Update StringDeduplicationAgeThreshold error message assertion to match JDK17 hotspot behavior - Adapt InternedTest: Replace the JDK 8 implementation with JDK 17 logic which verifies that interned strings are always deduplicated when being interned, and never after being interned - Update testPrintOptions: Use -Xlog:gc*,stringdedup* (info) to verify concurrent deduplication log presence instead of using JDK 8 specific flags Keep TestStringDeduplicationTableRehash.java excluded since JDK17 hotspot removed the string deduplication table rehash mechanism.
luchsh
left a comment
There was a problem hiding this comment.
after applying this patch, the modified test will no longer be suitable for a jdk8 build, is that a decided project specification?
| $(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)) | ||
| $(call overlay_single,jdk8u,hotspot/test/gc/g1/TestStringDeduplicationTools.java, $(JDK8_SRCROOT)) |
There was a problem hiding this comment.
there seems to be many tests to be processed, can we make a loop to do that recursively from overlay/jdk8u to $(JDK8_SRCROOT)?
|
|
||
| private static boolean waitForDeduplication(String s1, String s2) { | ||
| boolean first = true; | ||
| int timeout = 10000; // 10sec in ms |
There was a problem hiding this comment.
put the unit in var name will make it self-explainable
There was a problem hiding this comment.
This line is ported from jdk17
| System.out.println("End: InternedTest"); | ||
| } | ||
|
|
||
| private static void checkNotDeduplicated(Object value1, Object value2) { |
There was a problem hiding this comment.
This function is ported from jdk17
| // Force internedString to be inspected for deduplication. | ||
| // Because it was interned it should be queued up for | ||
| // dedup, even though it hasn't reached the age threshold. | ||
| doYoungGc(1); |
There was a problem hiding this comment.
the original test does not seem to have this gc call, why did you add it?
There was a problem hiding this comment.
This logic is ported from jdk17
Adapted gc/g1 StringDedup tests for JDK 17 compatibility.
Key changes:
Replaced JDK 8 style logging flags with JDK 17 Unified Logging (-Xlog:gc+stringdedup=debug).
Adapted expected error messages and output patterns to match JDK 17 behavior.
One deprecated test case (SurvivorAlignmentInBytes related) has been excluded and recorded as per the policy.