39 * @bug 8232069
40 * @requires vm.cds
41 * @requires vm.bits == 64
42 * @requires vm.gc.ZGenerational
43 * @requires vm.gc.Serial
44 * @requires vm.gc == null
45 * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
46 * @compile test-classes/Hello.java
47 * @run driver TestZGCWithCDS -XX:+ZGenerational
48 */
49
50 import jdk.test.lib.Platform;
51 import jdk.test.lib.process.OutputAnalyzer;
52
53 public class TestZGCWithCDS {
54 public final static String HELLO = "Hello World";
55 public final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
56 public final static String ERR_MSG = "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled.";
57 public static void main(String... args) throws Exception {
58 String zGenerational = args[0];
59 String helloJar = JarBuilder.build("hello", "Hello");
60 System.out.println("0. Dump with ZGC");
61 OutputAnalyzer out = TestCommon
62 .dump(helloJar,
63 new String[] {"Hello"},
64 "-XX:+UseZGC",
65 zGenerational,
66 "-Xlog:cds");
67 out.shouldContain("Dumping shared data to file:");
68 out.shouldHaveExitValue(0);
69
70 System.out.println("1. Run with same args of dump");
71 out = TestCommon
72 .exec(helloJar,
73 "-XX:+UseZGC",
74 zGenerational,
75 "-Xlog:cds",
76 "Hello");
77 out.shouldContain(HELLO);
78 out.shouldHaveExitValue(0);
79
80 System.out.println("2. Run with +UseCompressedOops +UseCompressedClassPointers");
81 out = TestCommon
82 .exec(helloJar,
83 "-XX:-UseZGC",
84 "-XX:+UseCompressedOops", // in case turned off by vmoptions
85 "-XX:+UseCompressedClassPointers", // by jtreg
86 "-Xlog:cds",
87 "Hello");
88 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
89 out.shouldContain(ERR_MSG);
90 out.shouldHaveExitValue(1);
91
92 System.out.println("3. Run with -UseCompressedOops -UseCompressedClassPointers");
93 out = TestCommon
94 .exec(helloJar,
95 "-XX:+UseSerialGC",
96 "-XX:-UseCompressedOops",
97 "-XX:-UseCompressedClassPointers",
98 "-Xlog:cds",
99 "Hello");
100 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
101 out.shouldContain(ERR_MSG);
102 out.shouldHaveExitValue(1);
103
104 System.out.println("4. Run with -UseCompressedOops +UseCompressedClassPointers");
105 out = TestCommon
106 .exec(helloJar,
107 "-XX:+UseSerialGC",
108 "-XX:-UseCompressedOops",
109 "-XX:+UseCompressedClassPointers",
110 "-Xlog:cds",
111 "Hello");
112 out.shouldContain(HELLO);
113 out.shouldHaveExitValue(0);
114
115 System.out.println("5. Run with +UseCompressedOops -UseCompressedClassPointers");
116 out = TestCommon
117 .exec(helloJar,
118 "-XX:+UseSerialGC",
119 "-XX:+UseCompressedOops",
120 "-XX:-UseCompressedClassPointers",
121 "-Xlog:cds",
122 "Hello");
123 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
124 out.shouldContain(ERR_MSG);
125 out.shouldHaveExitValue(1);
126
127 System.out.println("6. Run with +UseCompressedOops +UseCompressedClassPointers");
128 out = TestCommon
129 .exec(helloJar,
130 "-XX:+UseSerialGC",
131 "-XX:+UseCompressedOops",
132 "-XX:+UseCompressedClassPointers",
133 "-Xlog:cds",
134 "Hello");
135 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
136 out.shouldContain(ERR_MSG);
137 out.shouldHaveExitValue(1);
138
139 System.out.println("7. Dump with -UseCompressedOops -UseCompressedClassPointers");
140 out = TestCommon
141 .dump(helloJar,
142 new String[] {"Hello"},
143 "-XX:+UseSerialGC",
144 "-XX:-UseCompressedOops",
145 "-XX:+UseCompressedClassPointers",
146 "-Xlog:cds");
147 out.shouldContain("Dumping shared data to file:");
148 out.shouldHaveExitValue(0);
149
150 System.out.println("8. Run with ZGC");
151 out = TestCommon
152 .exec(helloJar,
153 "-XX:+UseZGC",
154 zGenerational,
155 "-Xlog:cds",
156 "Hello");
157 out.shouldContain(HELLO);
158 out.shouldHaveExitValue(0);
159 }
160 }
|
39 * @bug 8232069
40 * @requires vm.cds
41 * @requires vm.bits == 64
42 * @requires vm.gc.ZGenerational
43 * @requires vm.gc.Serial
44 * @requires vm.gc == null
45 * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
46 * @compile test-classes/Hello.java
47 * @run driver TestZGCWithCDS -XX:+ZGenerational
48 */
49
50 import jdk.test.lib.Platform;
51 import jdk.test.lib.process.OutputAnalyzer;
52
53 public class TestZGCWithCDS {
54 public final static String HELLO = "Hello World";
55 public final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
56 public final static String ERR_MSG = "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled.";
57 public static void main(String... args) throws Exception {
58 String zGenerational = args[0];
59 String compactHeaders = "-XX:" + (zGenerational.equals("-XX:+ZGenerational") ? "+" : "-") + "UseCompactObjectHeaders";
60 String helloJar = JarBuilder.build("hello", "Hello");
61 System.out.println("0. Dump with ZGC");
62 OutputAnalyzer out = TestCommon
63 .dump(helloJar,
64 new String[] {"Hello"},
65 "-XX:+UseZGC",
66 zGenerational,
67 "-XX:+UnlockExperimentalVMOptions",
68 compactHeaders,
69 "-Xlog:cds");
70 out.shouldContain("Dumping shared data to file:");
71 out.shouldHaveExitValue(0);
72
73 System.out.println("1. Run with same args of dump");
74 out = TestCommon
75 .exec(helloJar,
76 "-XX:+UseZGC",
77 zGenerational,
78 "-XX:+UnlockExperimentalVMOptions",
79 compactHeaders,
80 "-Xlog:cds",
81 "Hello");
82 out.shouldContain(HELLO);
83 out.shouldHaveExitValue(0);
84
85 System.out.println("2. Run with +UseCompressedOops +UseCompressedClassPointers");
86 out = TestCommon
87 .exec(helloJar,
88 "-XX:-UseZGC",
89 "-XX:+UseCompressedOops", // in case turned off by vmoptions
90 "-XX:+UseCompressedClassPointers", // by jtreg
91 "-XX:+UnlockExperimentalVMOptions",
92 compactHeaders,
93 "-Xlog:cds",
94 "Hello");
95 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
96 out.shouldContain(ERR_MSG);
97 out.shouldHaveExitValue(1);
98
99 System.out.println("3. Run with -UseCompressedOops -UseCompressedClassPointers");
100 out = TestCommon
101 .exec(helloJar,
102 "-XX:+UseSerialGC",
103 "-XX:-UseCompressedOops",
104 "-XX:-UseCompressedClassPointers",
105 "-XX:+UnlockExperimentalVMOptions",
106 compactHeaders,
107 "-Xlog:cds",
108 "Hello");
109 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
110 out.shouldContain(ERR_MSG);
111 out.shouldHaveExitValue(1);
112
113 System.out.println("4. Run with -UseCompressedOops +UseCompressedClassPointers");
114 out = TestCommon
115 .exec(helloJar,
116 "-XX:+UseSerialGC",
117 "-XX:-UseCompressedOops",
118 "-XX:+UseCompressedClassPointers",
119 "-XX:+UnlockExperimentalVMOptions",
120 compactHeaders,
121 "-Xlog:cds",
122 "Hello");
123 out.shouldContain(HELLO);
124 out.shouldHaveExitValue(0);
125
126 System.out.println("5. Run with +UseCompressedOops -UseCompressedClassPointers");
127 out = TestCommon
128 .exec(helloJar,
129 "-XX:+UseSerialGC",
130 "-XX:+UseCompressedOops",
131 "-XX:-UseCompressedClassPointers",
132 "-XX:+UnlockExperimentalVMOptions",
133 compactHeaders,
134 "-Xlog:cds",
135 "Hello");
136 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
137 out.shouldContain(ERR_MSG);
138 out.shouldHaveExitValue(1);
139
140 System.out.println("6. Run with +UseCompressedOops +UseCompressedClassPointers");
141 out = TestCommon
142 .exec(helloJar,
143 "-XX:+UseSerialGC",
144 "-XX:+UseCompressedOops",
145 "-XX:+UseCompressedClassPointers",
146 "-XX:+UnlockExperimentalVMOptions",
147 compactHeaders,
148 "-Xlog:cds",
149 "Hello");
150 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
151 out.shouldContain(ERR_MSG);
152 out.shouldHaveExitValue(1);
153
154 System.out.println("7. Dump with -UseCompressedOops -UseCompressedClassPointers");
155 out = TestCommon
156 .dump(helloJar,
157 new String[] {"Hello"},
158 "-XX:+UseSerialGC",
159 "-XX:-UseCompressedOops",
160 "-XX:+UseCompressedClassPointers",
161 "-XX:+UnlockExperimentalVMOptions",
162 compactHeaders,
163 "-Xlog:cds");
164 out.shouldContain("Dumping shared data to file:");
165 out.shouldHaveExitValue(0);
166
167 System.out.println("8. Run with ZGC");
168 out = TestCommon
169 .exec(helloJar,
170 "-XX:+UseZGC",
171 zGenerational,
172 "-XX:+UnlockExperimentalVMOptions",
173 compactHeaders,
174 "-Xlog:cds",
175 "Hello");
176 out.shouldContain(HELLO);
177 out.shouldHaveExitValue(0);
178 }
179 }
|