From 6cc66659fe6d0c364fb9920ebb61ddc4acb9ca03 Mon Sep 17 00:00:00 2001 From: Jiawei_Tang Date: Wed, 13 Dec 2023 19:30:05 +0800 Subject: [PATCH] [EagerAppCDS] fix compile bugs in testcase Summary: Since upstream delete `createJavaProcessBuilder`, those testcases need to call another functions to replace it. Testing: com/alibaba/cds/TestDumpAndLoadClass.java com/alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java com/alibaba/cds/TestDumpAndLoadClassWithException.java com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java com/alibaba/cds/TestDumpAndLoadClassWithWisp.java com/alibaba/cds/TestDumpAndLoadNotFound.java com/alibaba/cds/TestDumpAndLoadVerficationFailure.java com/alibaba/cds/TestDumpListInParallel.java com/alibaba/cds/TestDumpUnsupportedCheck.java com/alibaba/cds/TestLoadClassFlow.java com/alibaba/cds/TestWispWithAppCDS.java runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java com/alibaba/quickstart/TestMultiVersionedJar.java Reviewers: lingjun-cg, yulei Issue: https://github.com/dragonwell-project/dragonwell11/issues/731 --- .../eagerappcds/TestClassLoaderWithJVMTIAgent.java | 8 ++++---- test/jdk/com/alibaba/cds/Classes4CDS.java | 2 +- test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java | 6 +++--- .../alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java | 6 +++--- .../alibaba/cds/TestDumpAndLoadClassWithException.java | 6 +++--- .../com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java | 6 +++--- .../jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java | 6 +++--- test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java | 6 +++--- .../alibaba/cds/TestDumpAndLoadVerficationFailure.java | 6 +++--- test/jdk/com/alibaba/cds/TestDumpListInParallel.java | 4 ++-- test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java | 2 +- test/jdk/com/alibaba/cds/TestLoadClassFlow.java | 6 +++--- test/jdk/com/alibaba/cds/TestWispWithAppCDS.java | 6 +++--- .../jdk/com/alibaba/quickstart/TestMultiVersionedJar.java | 4 ++-- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/test/hotspot/jtreg/runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java b/test/hotspot/jtreg/runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java index b039feb9293..f6f65c5c052 100644 --- a/test/hotspot/jtreg/runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java +++ b/test/hotspot/jtreg/runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java @@ -108,7 +108,7 @@ public static void main(String[] args) throws Exception { } static void traceClasses() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-Xlog:class+eagerappcds=trace", "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, @@ -149,7 +149,7 @@ private static Path getJDKLibDir() { } static void convertClassList() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-cp", @@ -163,7 +163,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -188,7 +188,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/Classes4CDS.java b/test/jdk/com/alibaba/cds/Classes4CDS.java index a89fe9b2196..cc4660658f8 100644 --- a/test/jdk/com/alibaba/cds/Classes4CDS.java +++ b/test/jdk/com/alibaba/cds/Classes4CDS.java @@ -34,7 +34,7 @@ public class Classes4CDS { public static final String CLASSES4CDS = "com.alibaba.jvm.cds.Classes4CDS"; public static ProcessBuilder invokeClasses4CDS(String cds_original_list, String cds_final_list) { - return ProcessTools.createJavaProcessBuilder(true, + return ProcessTools.createTestJvm( "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-cp", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java index 22a9b66b89c..25a72e64ab8 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java @@ -88,7 +88,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -137,7 +137,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -161,7 +161,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java index 781eadc983b..aed2e9439ac 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithDifferentCP.java @@ -71,7 +71,7 @@ public static void main(String[] args) throws Exception { } static void dumpLoadedClasses() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be // included in the classlist @@ -86,7 +86,7 @@ static void dumpLoadedClasses() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:SharedClassListFile=" + CLASSLIST_FILE, @@ -121,7 +121,7 @@ static void changeSourcePath() throws Exception { static void startWithJsa() throws Exception { String classPath = "newpath/testSimple.jar:./test.jar"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Xshare:on", "-XX:SharedArchiveFile=" + ARCHIVE_FILE, "-XX:+AppCDSClassFingerprintCheck", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithException.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithException.java index adb21eccdae..6af2b6c606c 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithException.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithException.java @@ -79,7 +79,7 @@ public static void main(String[] args) throws Exception { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -103,7 +103,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -139,7 +139,7 @@ static void changeSourcePath() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java index 6565fa307a5..a88d8026574 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java @@ -90,7 +90,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -114,7 +114,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -139,7 +139,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java index 3289cce2534..2886bf14971 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java @@ -87,7 +87,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -137,7 +137,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -162,7 +162,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java index 6d74ec7448e..eb419c35584 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java @@ -87,7 +87,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -136,7 +136,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -160,7 +160,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpAndLoadVerficationFailure.java b/test/jdk/com/alibaba/cds/TestDumpAndLoadVerficationFailure.java index d57df229b67..4c57502f63c 100644 --- a/test/jdk/com/alibaba/cds/TestDumpAndLoadVerficationFailure.java +++ b/test/jdk/com/alibaba/cds/TestDumpAndLoadVerficationFailure.java @@ -92,7 +92,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -143,7 +143,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -167,7 +167,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestDumpListInParallel.java b/test/jdk/com/alibaba/cds/TestDumpListInParallel.java index accb743551f..56d0339a158 100644 --- a/test/jdk/com/alibaba/cds/TestDumpListInParallel.java +++ b/test/jdk/com/alibaba/cds/TestDumpListInParallel.java @@ -71,7 +71,7 @@ public static void main(String[] args) throws Exception { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -94,7 +94,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", diff --git a/test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java b/test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java index 3b32cfa7b8b..6a31898a816 100644 --- a/test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java +++ b/test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", "-XX:SharedClassListFile=" + System.getProperty("test.src", ".") + File.separator + CLASSLIST_FILE, diff --git a/test/jdk/com/alibaba/cds/TestLoadClassFlow.java b/test/jdk/com/alibaba/cds/TestLoadClassFlow.java index 4888b975a63..53e0ef391d9 100644 --- a/test/jdk/com/alibaba/cds/TestLoadClassFlow.java +++ b/test/jdk/com/alibaba/cds/TestLoadClassFlow.java @@ -88,7 +88,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -137,7 +137,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:+UnlockExperimentalVMOptions", @@ -161,7 +161,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerAppCDS", diff --git a/test/jdk/com/alibaba/cds/TestWispWithAppCDS.java b/test/jdk/com/alibaba/cds/TestWispWithAppCDS.java index d6b39718ebd..fd7e8abfaea 100644 --- a/test/jdk/com/alibaba/cds/TestWispWithAppCDS.java +++ b/test/jdk/com/alibaba/cds/TestWispWithAppCDS.java @@ -85,7 +85,7 @@ public static List toClassNames(String filename) throws IOException { } static void dumpLoadedClasses(String[] expectedClasses) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-XX:DumpLoadedClassList=" + CLASSLIST_FILE, // trigger JVMCI runtime init so that JVMCI classes will be @@ -110,7 +110,7 @@ static void convertClassList() throws Exception { } static void dumpArchive() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-cp", TESTJAR, "-XX:SharedClassListFile=" + CLASSLIST_FILE_2, @@ -136,7 +136,7 @@ static void dumpArchive() throws Exception { } static void startWithJsa() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Dtest.classes=" + TEST_CLASS, "-Xshare:on", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/jdk/com/alibaba/quickstart/TestMultiVersionedJar.java b/test/jdk/com/alibaba/quickstart/TestMultiVersionedJar.java index 890cfff05de..e8e04c9466b 100644 --- a/test/jdk/com/alibaba/quickstart/TestMultiVersionedJar.java +++ b/test/jdk/com/alibaba/quickstart/TestMultiVersionedJar.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws Exception { } static void trace(String parentDir) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Xquickstart:path=" + parentDir + "/quickstartcache", "-Xquickstart:verbose", "-Xlog:cds+jvmti=debug", @@ -59,7 +59,7 @@ static void trace(String parentDir) throws Exception { } static void replay(String parentDir) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + ProcessBuilder pb = ProcessTools.createTestJvm( "-Xquickstart:path=" + parentDir + "/quickstartcache", "-Xquickstart:verbose", "-Xlog:class+eagerappcds=trace",