[jdk11u-dev] RFR: 8214799: Add package declaration to each JTREG test case in the gc folder

Evgeny Astigeevich duke at openjdk.org
Tue Jul 5 10:59:45 UTC 2022


On Wed, 30 Mar 2022 12:58:01 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

> I want to backport this ot simplify follow-up test backports.
> 
> I had to do a row of straight-forward edits:
> 
> 
> The backport of shenandoah put the CriticalNative tests
> into a different location. This affects four files in this patch.
> 
> test/hotspot/jtreg/gc/CriticalNative.java
> I moved this to gc/shenandoah/jni because the other
> critical native test are located there, too.
> 
> test/hotspot/jtreg/gc/CriticalNativeArgs.java is at different 
> location in 11. Applied the patch to 
> test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
> 
> Additional @run commands had to be edited:
>  test/hotspot/jtreg/gc/TestFullGCALot.java
> 
> Differing context:
>  test/hotspot/jtreg/gc/TestHumongousReferenceObject.java
> 
> Copyright; @run has less VM arguments.
>  test/hotspot/jtreg/gc/TestNUMAPageSize.java
> 
> Test not in 11:
> test/hotspot/jtreg/gc/TestNoPerfCounter.java
> 
> Copyright: (It seems the shenandoah backport 8214259 omitted the copyright updates of these tests)
>  test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java
>  test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java
>  test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java
>  test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java                
>  test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java
>  test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java
>  test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java
>  test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java
> 
> @run commands were changed. Simple resolve. "8272783: Epsilon: Refactor tests to improve performance" was already backported.
>  test/hotspot/jtreg/gc/epsilon/TestAlignment.java
>  test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java
>  test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java
>  test/hotspot/jtreg/gc/epsilon/TestByteArrays.java
>  test/hotspot/jtreg/gc/epsilon/TestClasses.java
>  test/hotspot/jtreg/gc/epsilon/TestElasticTLAB.java
>  test/hotspot/jtreg/gc/epsilon/TestElasticTLABDecay.java
>  test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java
>  test/hotspot/jtreg/gc/epsilon/TestHelloWorld.java
>  test/hotspot/jtreg/gc/epsilon/TestLogTrace.java
>  test/hotspot/jtreg/gc/epsilon/TestManyThreads.java
>  test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java
>  test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java
>  test/hotspot/jtreg/gc/epsilon/TestMemoryPools.java
>  test/hotspot/jtreg/gc/epsilon/TestObjects.java          
>  test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java
>  test/hotspot/jtreg/gc/epsilon/TestRefArrays.java
>  test/hotspot/jtreg/gc/epsilon/TestUpdateCountersSteps.java
> 
> Not in 11: 
> test/hotspot/jtreg/gc/g1/TestEdenSurvivorLessThanMax.java
> test/hotspot/jtreg/gc/g1/TestPeriodicCollection.java
> test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java
> 
> Copyright:
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData00.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData05.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData10.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData15.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData20.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData25.java
>  test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData30.java
> 
> Not in 11: 
> test/hotspot/jtreg/gc/g1/TestStringTableStats.java
> 
> Resolved:
>  test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java
> 
> test/hotspot/jtreg/gc/libCriticalNative.c  is at different 
> location in 11. Applied the patch to 
> test/hotspot/jtreg/gc/shenandoah/jni/libCriticalNative.c
> 
> Not in 11: 
> test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
> test/hotspot/jtreg/gc/nvdimm/TestAllocateOldGenAt.java
> test/hotspot/jtreg/gc/nvdimm/TestAllocateOldGenAtError.java
> test/hotspot/jtreg/gc/nvdimm/TestAllocateOldGenAtMultiple.java
> test/hotspot/jtreg/gc/nvdimm/TestHumongousObjectsOnNvdimm.java
> test/hotspot/jtreg/gc/nvdimm/TestOldObjectsOnNvdimm.java
> test/hotspot/jtreg/gc/nvdimm/TestYoungObjectsOnDram.java
> 
> test/hotspot/jtreg/gc/stress/CriticalNativeStress.java is at different 
> location in 11. Applied the patch to
> test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java 
> 
> Copyright:
>  test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java
>  test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java
> 
> Resolved due to "8278115: gc/stress/gclocker/TestGCLockerWithSerial.java has duplicate -Xmx" and various shenandoah changes.
>  test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithShenandoah.java
>  test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithSerial.java
>  test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithShenandoah.java
>  test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithShenandoah.java
>  test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithShenandoah.java
> 
> Copyright:
>  test/hotspot/jtreg/gc/survivorAlignment/TestAllocationInEden.java
>  test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
>  test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
>  test/hotspot/jtreg/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
>  test/hotspot/jtreg/gc/survivorAlignment/TestPromotionToSurvivor.java
>  test/hotspot/jtreg/gc/whitebox/TestWBGC.java

Hi @GoeLin,
The backport misses the following changes in tests:

diff --git a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
index fca66ae07f..2e861b0f1c 100644
--- a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
+++ b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
@@ -37,20 +37,14 @@ package gc.shenandoah.jni;
  * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx51
2M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeArgs
  */
 public class CriticalNativeArgs {
-    static {
-        System.loadLibrary("CriticalNative");
-    }
-
-    static native boolean isNull(int[] a);
-
     public static void main(String[] args) {
         int[] arr = new int[2];

-        if (isNull(arr)) {
+        if (CriticalNative.isNull(arr)) {
             throw new RuntimeException("Should not be null");
         }

-        if (!isNull(null)) {
+        if (!CriticalNative.isNull(null)) {
             throw new RuntimeException("Should be null");
         }
     }
diff --git a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
index bb559820ac..27ae22940a 100644
--- a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
+++ b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
@@ -30,7 +30,7 @@ import gc.shenandoah.jni.CriticalNative;

 /* @test
  * @key randomness
- * @library /test/lib
+ * @library /test/lib /
  * @requires (os.arch =="x86_64" | os.arch == "amd64" | os.arch=="x86" | os.arch=="i386") & !vm.graal.enabled & vm.gc.Shenandoah
  *
  * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive    -XX:+ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeStress
@@ -43,18 +43,9 @@ import gc.shenandoah.jni.CriticalNative;
  * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeStress
  */
 public class CriticalNativeStress {
-    static {
-        System.loadLibrary("CriticalNative");
-    }
-
     static final int CYCLES = 50;
     static final int THREAD_PER_CASE = 1;

-    static native long sum1(long[] a);
-
-    // More than 6 parameters
-    static native long sum2(long a1, int[] a2, int[] a3, long[] a4, int[] a5);
-
     static long sum(long[] a) {
         long sum = 0;
         for (int index = 0; index < a.length; index++) {
@@ -93,7 +84,7 @@ public class CriticalNativeStress {
             create_garbage(index);
         }

-        long native_sum = sum1(arr);
+        long native_sum = CriticalNative.sum1(arr);
         long java_sum = sum(arr);
         if (native_sum != java_sum) {
             StringBuffer sb = new StringBuffer("Sums do not match: native = ")
@@ -135,7 +126,7 @@ public class CriticalNativeStress {
             create_garbage(index);
         }

-        long native_sum = sum2(a1, a2, a3, a4, a5);
+        long native_sum = CriticalNative.sum2(a1, a2, a3, a4, a5);
         long java_sum = a1 + sum(a2) + sum(a3) + sum(a4) + sum(a5);
         if (native_sum != java_sum) {
             StringBuffer sb = new StringBuffer("Sums do not match: native = ")


This causes `CriticalNativeArgs.java` and `CriticalNativeStress.java` to fail with `UnsatisfiedLinkError`.

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

PR: https://git.openjdk.org/jdk11u-dev/pull/966


More information about the jdk-updates-dev mailing list