Skip to content
Permalink
Browse files

8244491: make runtime/cds/appcds/TestZGCWithCDS.java test more robust

Reviewed-by: dholmes
  • Loading branch information
iignatev committed May 6, 2020
1 parent 5e83cb6 commit 9f86d94580535a53c791a9eb429480ceecb33699
Showing with 10 additions and 26 deletions.
  1. +10 −26 test/hotspot/jtreg/runtime/cds/appcds/TestZGCWithCDS.java
@@ -26,7 +26,7 @@
* @requires vm.cds
* @requires vm.bits == 64
* @requires vm.gc.Z
* @comment assuming that default GC supports both UseCompressedOops and UseCompressedClassPointers
* @requires vm.gc.Serial
* @requires vm.gc == null
* @comment Graal does not support ZGC
* @requires !vm.graal.enabled
@@ -44,7 +44,6 @@
public final static String ERR_MSG = "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled.";
public static void main(String... args) throws Exception {
String helloJar = JarBuilder.build("hello", "Hello");
// 0. dump with ZGC
System.out.println("0. Dump with ZGC");
OutputAnalyzer out = TestCommon
.dump(helloJar,
@@ -54,7 +53,6 @@ public static void main(String... args) throws Exception {
out.shouldContain("Dumping shared data to file:");
out.shouldHaveExitValue(0);

// 1. Run with same args of dump
System.out.println("1. Run with same args of dump");
out = TestCommon
.exec(helloJar,
@@ -64,34 +62,21 @@ public static void main(String... args) throws Exception {
out.shouldContain(HELLO);
out.shouldHaveExitValue(0);

// 2. Run with ZGC turned off
System.out.println("2. Run with ZGC turned off");
out = TestCommon
.exec(helloJar,
"-XX:-UseZGC",
"-XX:+UseCompressedOops", // in case turned off by vmoptions
"-XX:+UseCompressedClassPointers", // by jtreg
"-Xlog:cds",
"Hello");
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);

// 3. Run with -UseCompressedOops -UseCompressedClassPointers
System.out.println("3. Run with -UseCompressedOops -UseCompressedClassPointers");
System.out.println("2. Run with -UseCompressedOops -UseCompressedClassPointers");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:-UseCompressedOops",
"-XX:-UseCompressedClassPointers",
"-Xlog:cds",
"Hello");
out.shouldContain(HELLO);
out.shouldHaveExitValue(0);

// 4. Run with +UseCompressedOops -UseCompressedClassPointers
System.out.println("4. Run with +UseCompressedOops -UseCompressedClassPointers");
System.out.println("3. Run with +UseCompressedOops -UseCompressedClassPointers");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:+UseCompressedOops",
"-XX:-UseCompressedClassPointers",
"-Xlog:cds",
@@ -100,10 +85,10 @@ public static void main(String... args) throws Exception {
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);

// 5. Run with +UseCompressedOops +UseCompressedClassPointers
System.out.println("5. Run with +UseCompressedOops +UseCompressedClassPointers");
System.out.println("4. Run with +UseCompressedOops +UseCompressedClassPointers");
out = TestCommon
.exec(helloJar,
"-XX:+UseSerialGC",
"-XX:+UseCompressedOops",
"-XX:+UseCompressedClassPointers",
"-Xlog:cds",
@@ -112,19 +97,18 @@ public static void main(String... args) throws Exception {
out.shouldContain(ERR_MSG);
out.shouldHaveExitValue(1);

// 6. dump with -UseCompressedOops -UseCompressedClassPointers
System.out.println("6. Dump with -UseCompressedOops -UseCompressedClassPointers");
System.out.println("5. Dump with -UseCompressedOops -UseCompressedClassPointers");
out = TestCommon
.dump(helloJar,
new String[] {"Hello"},
"-XX:+UseSerialGC",
"-XX:-UseCompressedOops",
"-XX:-UseCompressedClassPointers",
"-Xlog:cds");
out.shouldContain("Dumping shared data to file:");
out.shouldHaveExitValue(0);

// 7. Run with ZGC
System.out.println("7. Run with ZGC");
System.out.println("6. Run with ZGC");
out = TestCommon
.exec(helloJar,
"-XX:+UseZGC",

0 comments on commit 9f86d94

Please sign in to comment.