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 "-Xlog:cds",
106 "Hello");
107 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
108 out.shouldContain(ERR_MSG);
109 out.shouldHaveExitValue(1);
110
111 System.out.println("4. Run with -UseCompressedOops +UseCompressedClassPointers");
112 out = TestCommon
113 .exec(helloJar,
114 "-XX:+UseSerialGC",
115 "-XX:-UseCompressedOops",
116 "-XX:+UseCompressedClassPointers",
117 "-XX:+UnlockExperimentalVMOptions",
118 compactHeaders,
119 "-Xlog:cds",
120 "Hello");
121 out.shouldContain(HELLO);
122 out.shouldHaveExitValue(0);
123
124 System.out.println("5. Run with +UseCompressedOops -UseCompressedClassPointers");
125 out = TestCommon
126 .exec(helloJar,
127 "-XX:+UseSerialGC",
128 "-XX:+UseCompressedOops",
129 "-XX:-UseCompressedClassPointers",
130 "-Xlog:cds",
131 "Hello");
132 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
133 out.shouldContain(ERR_MSG);
134 out.shouldHaveExitValue(1);
135
136 System.out.println("6. Run with +UseCompressedOops +UseCompressedClassPointers");
137 out = TestCommon
138 .exec(helloJar,
139 "-XX:+UseSerialGC",
140 "-XX:+UseCompressedOops",
141 "-XX:+UseCompressedClassPointers",
142 "-XX:+UnlockExperimentalVMOptions",
143 compactHeaders,
144 "-Xlog:cds",
145 "Hello");
146 out.shouldContain(UNABLE_TO_USE_ARCHIVE);
147 out.shouldContain(ERR_MSG);
148 out.shouldHaveExitValue(1);
149
150 System.out.println("7. Dump with -UseCompressedOops -UseCompressedClassPointers");
151 out = TestCommon
152 .dump(helloJar,
153 new String[] {"Hello"},
154 "-XX:+UseSerialGC",
155 "-XX:-UseCompressedOops",
156 "-XX:+UseCompressedClassPointers",
157 "-XX:+UnlockExperimentalVMOptions",
158 compactHeaders,
159 "-Xlog:cds");
160 out.shouldContain("Dumping shared data to file:");
161 out.shouldHaveExitValue(0);
162
163 System.out.println("8. Run with ZGC");
164 out = TestCommon
165 .exec(helloJar,
166 "-XX:+UseZGC",
167 zGenerational,
168 "-XX:+UnlockExperimentalVMOptions",
169 compactHeaders,
170 "-Xlog:cds",
171 "Hello");
172 out.shouldContain(HELLO);
173 out.shouldHaveExitValue(0);
174 }
175 }
|