Skip to content

Commit

Permalink
[EagerAppCDS] fix compile bugs in testcase
Browse files Browse the repository at this point in the history
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: #731
  • Loading branch information
jia-wei-tang committed Dec 8, 2023
1 parent 132a164 commit 677c135
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/com/alibaba/cds/Classes4CDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestDumpAndLoadClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static List<String> 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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithNullURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static List<String> 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
Expand All @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestDumpAndLoadClassWithWisp.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static List<String> 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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestDumpAndLoadNotFound.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static List<String> 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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static List<String> 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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/com/alibaba/cds/TestDumpListInParallel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/com/alibaba/cds/TestDumpUnsupportedCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestLoadClassFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static List<String> 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
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/com/alibaba/cds/TestWispWithAppCDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static List<String> 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
Expand All @@ -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,
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/com/alibaba/quickstart/TestMultiVersionedJar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 677c135

Please sign in to comment.