From 696532135fb7dc62f4356531b6047d0620149447 Mon Sep 17 00:00:00 2001
Date: Fri, 16 Apr 2021 11:26:40 +0800
Subject: [PATCH 1/3] add missing test case

---
 .../test/runtime/appcds/DirClasspathTest.java |  4 +-
 .../runtime/appcds/MismatchedUseAppCDS.java   |  8 ++--
 hotspot/test/runtime/appcds/TestCommon.java   |  2 +
 .../java/testlibrary/OutputAnalyzer.java      |  2 +-
 .../lookup/TestDefenderMethodLookup.java      |  2 +
 .../templates/SSLSocketSSLEngineTemplate.java | 17 +++++++-
 .../security/lib/cacerts/VerifyCACerts.java   | 12 +-----
 .../com/huawei/openjdk/TestAdaptiveHeap.java  | 42 +++++++++++++++++++
 version.txt                                   |  1 +
 9 files changed, 70 insertions(+), 20 deletions(-)
 create mode 100644 test/jdk/com/huawei/openjdk/TestAdaptiveHeap.java
 create mode 100644 version.txt

diff --git a/hotspot/test/runtime/appcds/DirClasspathTest.java b/hotspot/test/runtime/appcds/DirClasspathTest.java
index e2c4e698..70ea728a 100644
--- a/hotspot/test/runtime/appcds/DirClasspathTest.java
+++ b/hotspot/test/runtime/appcds/DirClasspathTest.java
@@ -103,14 +103,14 @@ public class DirClasspathTest {
         // Non-empty dir in -cp: should report error if a class is loaded from it
         output = TestCommon.dump(classDir.toString(), appClassList2);
         output.shouldNotHaveExitValue(1);
-        output.shouldContain("Cannot find com/sun/tools/javac/Main");
+        output.shouldContain("Preload failed: com/sun/tools/javac/Main");
         // Long path to non-empty dir in -cp: should report error if a class is loaded from it
         File srcClass = new File(classDir.toFile(), "Hello.class");
         File destClass = new File(longDir, "Hello.class");
         Files.copy(srcClass.toPath(), destClass.toPath());
         output = TestCommon.dump(longDir.getPath(), appClassList2);
         output.shouldNotHaveExitValue(1);
-        output.shouldContain("Cannot find Hello");
+        output.shouldContain("Rewriting and linking classes: done");
     }
 }
 
diff --git a/hotspot/test/runtime/appcds/MismatchedUseAppCDS.java b/hotspot/test/runtime/appcds/MismatchedUseAppCDS.java
index 7173d6c9..599fdc5e 100644
--- a/hotspot/test/runtime/appcds/MismatchedUseAppCDS.java
+++ b/hotspot/test/runtime/appcds/MismatchedUseAppCDS.java
@@ -46,12 +46,12 @@ public class MismatchedUseAppCDS {
         // (1): dump with -XX:+UseAppCDS, but run with -XX:-UseAppCDS
         TestCommon.testDump(appJar, TestCommon.list("CheckIfShared"),
                 // command-line arguments ...
-                "-XX:+UseAppCDS",
                 use_whitebox_jar);
 
         output = TestCommon.exec(appJar,
                 // command-line arguments ...
                 use_whitebox_jar,
+                "-XX:-UseAppCDS",
                 "-XX:+UnlockDiagnosticVMOptions",
                 "-XX:+WhiteBoxAPI",
                 "CheckIfShared", "false");
@@ -60,17 +60,15 @@ public class MismatchedUseAppCDS {
         // (2): dump with -XX:-UseAppCDS, but run with -XX:+UseAppCDS
         TestCommon.testDump(appJar, TestCommon.list("CheckIfShared"),
                 // command-line arguments ...
-                "-XX:+UseAppCDS",
+                "-XX:-UseAppCDS",
                 use_whitebox_jar);
 
         output = TestCommon.exec(appJar,
                 // command-line arguments ...
                 use_whitebox_jar,
-                "-XX:+UseAppCDS",
                 "-XX:+UnlockDiagnosticVMOptions",
                 "-XX:+WhiteBoxAPI",
-                "CheckIfShared", "true");
+                "CheckIfShared", "false");
         TestCommon.checkExec(output);
     }
 }
-
diff --git a/hotspot/test/runtime/appcds/TestCommon.java b/hotspot/test/runtime/appcds/TestCommon.java
index 4ed416fe..22eef4ed 100644
--- a/hotspot/test/runtime/appcds/TestCommon.java
+++ b/hotspot/test/runtime/appcds/TestCommon.java
@@ -131,6 +131,7 @@ public class TestCommon extends CDSTestUtils {
         }
 
         cmd.add("-Xshare:dump");
+        cmd.add("-XX:+UseAppCDS");
 //        cmd.add("-Xlog:cds,cds+hashtables"); comment out because it will be run by jdk1.8
         cmd.add("-XX:ExtraSharedClassListFile=" + classList.getPath());
 
@@ -156,6 +157,7 @@ public class TestCommon extends CDSTestUtils {
         for (String p : opts.prefix) cmd.add(p);
 
         cmd.add("-Xshare:" + opts.xShareMode);
+        cmd.add("-XX:+UseAppCDS");
         cmd.add("-showversion");
         cmd.add("-XX:SharedArchiveFile=" + getCurrentArchiveName());
         cmd.add("-Dtest.timeout.factor=" + timeoutFactor);
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
index 2132325f..2221ea4a 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
@@ -163,7 +163,7 @@ public final class OutputAnalyzer {
     }
     return this;
   }
-
+  
   /**
    * Verify the exit value of the process
    * backport from jdk11u
diff --git a/jdk/test/java/lang/invoke/lookup/TestDefenderMethodLookup.java b/jdk/test/java/lang/invoke/lookup/TestDefenderMethodLookup.java
index 2ee40289..8ab268b5 100644
--- a/jdk/test/java/lang/invoke/lookup/TestDefenderMethodLookup.java
+++ b/jdk/test/java/lang/invoke/lookup/TestDefenderMethodLookup.java
@@ -1,6 +1,8 @@
 /*
  * @test
+ * @author zhangli
  * @bug 8203699
+ * @summary see https://code.huawei.com/HuaweiJDK/JVM-team/JVM/issues/1368
  * @run testng/othervm test.java.lang.invoke.lookup.TestDefenderMethodLookup
  */
 
diff --git a/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java b/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java
index 54b4e3c6..16af82f0 100644
--- a/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java
+++ b/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java
@@ -157,8 +157,11 @@ public class SSLSocketSSLEngineTemplate {
             new SSLSocketSSLEngineTemplate(protocol);
         log("-------------------------------------");
         log("Testing " + protocol + " for direct buffers ...");
-        test.runTest(true);
-
+        
+	test.runTest(true);
+        // invalid session
+        
+	test.invalidSession();
         log("---------------------------------------");
         log("Testing " + protocol + " for indirect buffers ...");
         test.runTest(false);
@@ -529,4 +532,14 @@ public class SSLSocketSSLEngineTemplate {
             }
         }
     }
+
+    /*
+     * invalid session
+     */
+    private void invalidSession() {
+        if (sslSocket != null && sslSocket.getSession() != null) {
+            sslSocket.getSession().invalidate();
+        }
+    }
 }
+
diff --git a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
index 29d4f0f9..7a9c4583 100644
--- a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
+++ b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
@@ -52,12 +52,12 @@ public class VerifyCACerts {
             + File.separator + "security" + File.separator + "cacerts";
 
     // The numbers of certs now.
-    private static final int COUNT = 90;
+    private static final int COUNT = 88;
 
     // SHA-256 of cacerts, can be generated with
     // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
     private static final String CHECKSUM
-            = "8E:A5:85:3C:66:C0:7C:B1:2A:B6:67:31:B3:4A:8E:78:1B:8D:DC:49:F1:42:65:DB:CE:7C:69:41:F3:94:3A:F7";
+            = "25:2F:A9:73:74:A5:62:71:E0:12:75:FB:E7:C0:BF:BF:38:E5:B1:93:72:D4:2C:3C:2D:4D:B8:FA:05:F7:EC:3F";
 
     // map of cert alias to SHA-256 fingerprint
     @SuppressWarnings("serial")
@@ -146,10 +146,6 @@ public class VerifyCACerts {
                     "5D:56:49:9B:E4:D2:E0:8B:CF:CA:D0:8A:3E:38:72:3D:50:50:3B:DE:70:69:48:E4:2F:55:60:30:19:E5:28:AE");
             put("letsencryptisrgx1 [jdk]",
                     "96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6");
-            put("luxtrustglobalrootca [jdk]",
-                    "A1:B2:DB:EB:64:E7:06:C6:16:9E:3C:41:18:B2:3B:AA:09:01:8A:84:27:66:6D:8B:F0:E2:88:91:EC:05:19:50");
-            put("quovadisrootca [jdk]",
-                    "A4:5E:DE:3B:BB:F0:9C:8A:E1:5C:72:EF:C0:72:68:D6:93:A2:1C:99:6F:D5:1E:67:CA:07:94:60:FD:6D:88:73");
             put("quovadisrootca1g3 [jdk]",
                     "8A:86:6F:D1:B2:76:B5:7E:57:8E:92:1C:65:82:8A:2B:ED:58:E9:F2:F2:88:05:41:34:B7:F1:F4:BF:C9:CC:74");
             put("quovadisrootca2 [jdk]",
@@ -246,12 +242,8 @@ public class VerifyCACerts {
     @SuppressWarnings("serial")
     private static final HashSet<String> EXPIRY_EXC_ENTRIES = new HashSet<String>() {
         {
-            // Valid until: Wed Mar 17 17:51:37 HKT 2021
-            add("luxtrustglobalrootca [jdk]");
             // Valid until: Tue Apr 06 15:29:40 HKT 2021
             add("soneraclass2ca [jdk]");
-            // Valid until: Thu Mar 18 02:33:33 HKT 2021
-            add("quovadisrootca [jdk]");
         }
     };
 
diff --git a/test/jdk/com/huawei/openjdk/TestAdaptiveHeap.java b/test/jdk/com/huawei/openjdk/TestAdaptiveHeap.java
new file mode 100644
index 00000000..bd22ba83
--- /dev/null
+++ b/test/jdk/com/huawei/openjdk/TestAdaptiveHeap.java
@@ -0,0 +1,42 @@
+package com.huawei.openjdk.adaptiveheap;
+ /**
+  * @test TestAdaptiveHeap.java
+  * @key gc
+  * @library /testlibrary
+  * @build com.huawei.openjdk.adaptiveheap.TestAdaptiveHeap
+  * @run main/othervm  com.huawei.openjdk.adaptiveheap.TestAdaptiveHeap  -Xms16G -Xmx16G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1PeriodicGCLoadThreshold=20 -XX:G1PeriodicGCInterval=15000 -XX:+G1Uncommit
+  * @summary test adaptheap
+  * @author wangruishun
+  */
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+public class TestAdaptiveHeap {
+
+    public static void main(String[] args)throws Exception {
+        final String[] arguments = {
+                "-Xbootclasspath/a:.",
+                "-Xmx16G",
+                ExeTest.class.getName(),
+                args[0],
+                args[1],
+                args[2],
+                args[3],
+                args[4],
+                args[5],
+                args[6]
+        };
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+        System.out.println();
+    }
+
+    private static class ExeTest {
+	public static void main(String[] str){
+		System.out.println();
+	}
+    }
+}
diff --git a/version.txt b/version.txt
new file mode 100644
index 00000000..9b614024
--- /dev/null
+++ b/version.txt
@@ -0,0 +1 @@
+8.282.8.0.13
-- 
2.23.0

