102 testDump(10, "-XX:+UseG1GC", "-Xmx1g", null, false);
103 testExec(10, "-XX:+UseG1GC", "-Xmx32g", null, true);
104
105 // CompactStrings must match between dump time and run time
106 testDump(11, "-XX:+UseG1GC", "-XX:-CompactStrings", null, false);
107 testExec(11, "-XX:+UseG1GC", "-XX:+CompactStrings",
108 COMPACT_STRING_MISMATCH, true);
109 testDump(12, "-XX:+UseG1GC", "-XX:+CompactStrings", null, false);
110 testExec(12, "-XX:+UseG1GC", "-XX:-CompactStrings",
111 COMPACT_STRING_MISMATCH, true);
112 }
113
114 static void testDump(int testCaseNr, String collectorOption, String extraOption,
115 String expectedWarning, boolean expectedToFail) throws Exception {
116
117 System.out.println("Testcase: " + testCaseNr);
118 OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
119 "-XX:+UseCompressedOops",
120 collectorOption,
121 "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
122 extraOption);
123
124 if (expectedWarning != null)
125 output.shouldContain(expectedWarning);
126
127 if (expectedToFail) {
128 Asserts.assertNE(output.getExitValue(), 0,
129 "JVM is expected to fail, but did not");
130 }
131 }
132
133 static void testExec(int testCaseNr, String collectorOption, String extraOption,
134 String expectedWarning, boolean expectedToFail) throws Exception {
135
136 OutputAnalyzer output;
137 System.out.println("Testcase: " + testCaseNr);
138
139 // needed, otherwise system considers empty extra option as a
140 // main class param, and fails with "Could not find or load main class"
141 if (!extraOption.isEmpty()) {
|
102 testDump(10, "-XX:+UseG1GC", "-Xmx1g", null, false);
103 testExec(10, "-XX:+UseG1GC", "-Xmx32g", null, true);
104
105 // CompactStrings must match between dump time and run time
106 testDump(11, "-XX:+UseG1GC", "-XX:-CompactStrings", null, false);
107 testExec(11, "-XX:+UseG1GC", "-XX:+CompactStrings",
108 COMPACT_STRING_MISMATCH, true);
109 testDump(12, "-XX:+UseG1GC", "-XX:+CompactStrings", null, false);
110 testExec(12, "-XX:+UseG1GC", "-XX:-CompactStrings",
111 COMPACT_STRING_MISMATCH, true);
112 }
113
114 static void testDump(int testCaseNr, String collectorOption, String extraOption,
115 String expectedWarning, boolean expectedToFail) throws Exception {
116
117 System.out.println("Testcase: " + testCaseNr);
118 OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
119 "-XX:+UseCompressedOops",
120 collectorOption,
121 "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
122 "-Xlog:cds,cds+hashtables",
123 extraOption);
124
125 if (expectedWarning != null)
126 output.shouldContain(expectedWarning);
127
128 if (expectedToFail) {
129 Asserts.assertNE(output.getExitValue(), 0,
130 "JVM is expected to fail, but did not");
131 }
132 }
133
134 static void testExec(int testCaseNr, String collectorOption, String extraOption,
135 String expectedWarning, boolean expectedToFail) throws Exception {
136
137 OutputAnalyzer output;
138 System.out.println("Testcase: " + testCaseNr);
139
140 // needed, otherwise system considers empty extra option as a
141 // main class param, and fails with "Could not find or load main class"
142 if (!extraOption.isEmpty()) {
|