mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-06 04:59:02 +00:00
David: minimize diffs in TestZGCWithCDS.java
This commit is contained in:
parent
2b5fe3a4b3
commit
b788a048fd
@ -38,20 +38,18 @@ import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class TestZGCWithCDS {
|
||||
private final static String HELLO = "Hello World";
|
||||
private final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
|
||||
private final static String ERR_MSG = "The saved state of UseCompressedOops (0) is different from runtime (1), CDS will be disabled.";
|
||||
private final static String COMPACT_OBJECT_HEADERS = "-XX:+UseCompactObjectHeaders";
|
||||
|
||||
public final static String HELLO = "Hello World";
|
||||
public final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
|
||||
public final static String ERR_MSG = "The saved state of UseCompressedOops (0) is different from runtime (1), CDS will be disabled.";
|
||||
public static void main(String... args) throws Exception {
|
||||
|
||||
String compactHeaders = "-XX:+UseCompactObjectHeaders";
|
||||
String helloJar = JarBuilder.build("hello", "Hello");
|
||||
System.out.println("0. Dump with ZGC");
|
||||
OutputAnalyzer out = TestCommon
|
||||
.dump(helloJar,
|
||||
new String[] {"Hello"},
|
||||
"-XX:+UseZGC",
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
compactHeaders,
|
||||
"-Xlog:cds");
|
||||
out.shouldContain("Dumping shared data to file:");
|
||||
out.shouldHaveExitValue(0);
|
||||
@ -60,55 +58,49 @@ public class TestZGCWithCDS {
|
||||
out = TestCommon
|
||||
.exec(helloJar,
|
||||
"-XX:+UseZGC",
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
compactHeaders,
|
||||
"-Xlog:cds",
|
||||
"Hello");
|
||||
out.shouldContain(HELLO);
|
||||
out.shouldHaveExitValue(0);
|
||||
|
||||
System.out.println("2. Run with +UseCompressedOops");
|
||||
System.out.println("2. Run with ZGC, +UseCompressedOops");
|
||||
out = TestCommon
|
||||
.exec(helloJar,
|
||||
"-XX:-UseZGC",
|
||||
"-XX:+UseCompressedOops", // in case turned off by vmoptions
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
"-XX:+UseCompressedClassPointers", // by jtreg
|
||||
compactHeaders,
|
||||
"-Xlog:cds",
|
||||
"Hello");
|
||||
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
|
||||
out.shouldContain(ERR_MSG);
|
||||
out.shouldHaveExitValue(1);
|
||||
|
||||
System.out.println("4. Run with -UseCompressedOops");
|
||||
System.out.println("3. Run with SerialGC, -UseCompressedOops");
|
||||
out = TestCommon
|
||||
.exec(helloJar,
|
||||
"-XX:+UseSerialGC",
|
||||
"-XX:-UseCompressedOops",
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
"-XX:+UseCompressedClassPointers",
|
||||
compactHeaders,
|
||||
"-Xlog:cds",
|
||||
"Hello");
|
||||
out.shouldContain(HELLO);
|
||||
out.shouldHaveExitValue(0);
|
||||
|
||||
System.out.println("6. Run with +UseCompressedOops");
|
||||
System.out.println("6. Run with SerialGC, +UseCompressedOops");
|
||||
out = TestCommon
|
||||
.exec(helloJar,
|
||||
"-XX:+UseSerialGC",
|
||||
"-XX:+UseCompressedOops",
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
"-XX:+UseCompressedClassPointers",
|
||||
compactHeaders,
|
||||
"-Xlog:cds",
|
||||
"Hello");
|
||||
out.shouldContain(UNABLE_TO_USE_ARCHIVE);
|
||||
out.shouldContain(ERR_MSG);
|
||||
out.shouldHaveExitValue(1);
|
||||
|
||||
System.out.println("8. Run with ZGC");
|
||||
out = TestCommon
|
||||
.exec(helloJar,
|
||||
"-XX:+UseZGC",
|
||||
COMPACT_OBJECT_HEADERS,
|
||||
"-Xlog:cds",
|
||||
"Hello");
|
||||
out.shouldContain(HELLO);
|
||||
out.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user